# development > How to build, test, and run the SRE Agent project locally - Author: marcel - Repository: marcellmueller/sre-agent - Version: 20260126165742 - Stars: 0 - Forks: 0 - Last Updated: 2026-02-06 - Source: https://github.com/marcellmueller/sre-agent - Web: https://mule.run/skillshub/@@marcellmueller/sre-agent~development:20260126165742 --- --- description: How to build, test, and run the SRE Agent project locally --- # Development Guide > [!CAUTION] > **NEVER run `make deploy` or `make deploy-agent` yourself.** > These require `sudo`. Ask the user to run them manually. See `deployment` skill. ## Prerequisites - Go 1.21+ - Docker (optional, for container builds) - K3s (for cluster features) - Ollama (for LLM features) ## Building ```bash # Build all Go modules including MCP servers make build # Build only MCP servers to bin/ make build-mcp # Sync all Go modules make tidy ``` ## Running Locally ```bash # Run TUI with MCP servers (requires MCP binaries in bin/) SERV_BIN_DIR=./bin make run-tui # Run API server make run-api # Verify API health curl localhost:8080/health ``` ## Testing ```bash # Run all tests make test # Run tests with coverage report make test-coverage # View HTML coverage report go tool cover -html=coverage.out ``` ## Pre-commit & Linting ```bash # Install pre-commit hooks (one-time setup) pip install pre-commit pre-commit install # Run all hooks manually pre-commit run --all-files # Run golangci-lint directly golangci-lint run ./... ``` Configuration files: - `.pre-commit-config.yaml` - Hook configuration - `.golangci.yml` - Linter rules (gofumpt, staticcheck, etc.) ## Go Workspace This project uses Go workspaces (`go.work`). All modules are linked: - `apps/api` - API server module - `apps/tui` - TUI application module - `pkg` - Shared packages module - `mcp/k3s` - K3s MCP server module - `mcp/filesystem` - Filesystem MCP server module When adding new dependencies: ```bash cd go get make tidy # Sync all modules ``` ## Common Issues ### MCP servers not found Ensure `SERV_BIN_DIR` points to the directory containing `k3s-mcp` and `filesystem-mcp` binaries: ```bash make build-mcp SERV_BIN_DIR=./bin make run-tui ``` ### Module sync issues ```bash make tidy # Syncs go.work and all go.mod files ``` ## TUI Styles The TUI uses a centralized styles package at `apps/tui/internal/styles/styles.go`. **Always use the styles package** instead of defining inline colors/styles: ```go import "github.com/marcellmueller/sre-agent/apps/tui/internal/styles" // ✅ Good - use centralized styles b.WriteString(styles.TitleStyle().Render("My Title")) b.WriteString(styles.ErrorStyle().Render("Error: " + err.Error())) tableStyles := styles.DefaultTableStyles() // ❌ Bad - inline color definitions titleStyle := lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("205")) ``` The styles package provides: - **Theme struct**: All colors in one place (supports future theme switching) - **Color constants**: `Current.Title`, `Current.Success`, `Current.Error`, etc. - **Layout constants**: `TableHeightDefault` (10), `TableHeightCompact` (5) - **Style functions**: `TitleStyle()`, `ActiveStyle()`, `ErrorStyle()`, `DefaultTableStyles()`, etc.