|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | + |
| 5 | +- `cmd/` hosts CLI entry points; each subfolder targets a runnable binary. |
| 6 | +- `pkg/` contains shared packages for configuration, sensors, and platform adapters. |
| 7 | +- `internal/` stores private helpers that shouldn’t be imported by external modules. |
| 8 | +- `test/` aggregates integration fixtures and end-to-end scenarios. |
| 9 | +- `assets/` includes sample policies, mock secrets, and agent templates. |
| 10 | + |
| 11 | +## Build, Test, and Development Commands |
| 12 | + |
| 13 | +- `make build` compiles all binaries into `bin/`; adds version metadata from `git describe`. |
| 14 | +- `make test` runs unit and integration suites via Go’s testing framework with race detection. |
| 15 | +- `make lint` executes `golangci-lint` using repository defaults. |
| 16 | +- `go run ./cmd/envguard` launches the local agent pointing at the sample config in `configs/dev.yaml`. |
| 17 | + |
| 18 | +## Coding Style & Naming Conventions |
| 19 | + |
| 20 | +- Use Go 1.22 defaults: tabs for indentation, `gofmt` before commit. |
| 21 | +- Exported types follow PascalCase; private helpers use lowerCamelCase; constants are UPPER_SNAKE. |
| 22 | +- Interface files live beside their implementations and end in `_iface.go`. |
| 23 | +- Keep package names singular and short (`sensor`, `policy`). |
| 24 | + |
| 25 | +## Testing Guidelines |
| 26 | + |
| 27 | +- Unit tests mirror package names with `_test.go`; function tests use `TestFunctionName`. |
| 28 | +- Integration tests live under `test/integration` and are tagged with `//go:build integration`. |
| 29 | +- Ensure new packages reach ≥80% coverage (`go test ./... -cover`). |
| 30 | +- Snapshot fixtures belong in `testdata/` within each package. |
| 31 | + |
| 32 | +## Commit & Pull Request Guidelines |
| 33 | + |
| 34 | +- Prefer conventional commits (`feat:`, `fix:`, `docs:`); keep subject lines ≤72 characters. |
| 35 | +- Reference issues with `Fixes #123` or `Refs #123` in commit or PR descriptions. |
| 36 | +- Pull requests require: summary of changes, validation steps (commands run), screenshots for UI/CLI diffs. |
| 37 | + |
| 38 | +## Security & Configuration Tips |
| 39 | + |
| 40 | +- Store secrets in `.envguard/` with SOPS; never commit decrypted files. |
| 41 | +- Run `make audit` before release to scan dependencies for known CVEs. |
0 commit comments