|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure |
| 4 | + |
| 5 | +- `cmd/lametric/`: CLI entrypoint |
| 6 | +- `internal/`: implementation |
| 7 | + - `cmd/`: command routing (kong CLI framework) |
| 8 | + - `api/`: LaMetric device API client |
| 9 | + - `auth/`: keyring-based credential storage |
| 10 | + - `config/`: YAML configuration |
| 11 | + - `discovery/`: mDNS/SSDP device discovery |
| 12 | + - `output/`: terminal rendering (lipgloss) |
| 13 | + - `errfmt/`: error formatting |
| 14 | +- `bin/`: build outputs |
| 15 | + |
| 16 | +## Build, Test, and Development Commands |
| 17 | + |
| 18 | +- `make build`: compile to `bin/lametric` |
| 19 | +- `make lametric -- <args>`: build + run (e.g., `make lametric -- notify "Hello"`) |
| 20 | +- `make fmt` / `make lint` / `make test` / `make ci`: format, lint, test, full local gate |
| 21 | +- `make tools`: install pinned dev tools into `.tools/` |
| 22 | +- `make clean`: remove bin/ and .tools/ |
| 23 | + |
| 24 | +## Coding Style & Naming Conventions |
| 25 | + |
| 26 | +- Formatting: `make fmt` (goimports local prefix `github.com/dedene/lametric-cli` + gofumpt) |
| 27 | +- Output: keep stdout parseable (`--json`); send human hints/progress to stderr |
| 28 | +- Linting: golangci-lint v2.8.0 with project config |
| 29 | + |
| 30 | +## Testing Guidelines |
| 31 | + |
| 32 | +- Unit tests: stdlib `testing` (files: `*_test.go` next to code) |
| 33 | +- 11 test files; comprehensive coverage |
| 34 | +- CI gate: fmt-check, lint, test |
| 35 | + |
| 36 | +## Config & Secrets |
| 37 | + |
| 38 | +- **Keyring**: 99designs/keyring for API key storage (macOS Keychain, Linux SecretService, file backend) |
| 39 | +- **Env var fallback**: `LAMETRIC_API_KEY` |
| 40 | +- **Keyring backend**: `LAMETRIC_KEYRING_BACKEND` (auto/keychain/file) |
| 41 | +- **Keyring password**: `LAMETRIC_KEYRING_PASSWORD` (for file backend) |
| 42 | +- **Device discovery**: automatic via mDNS/SSDP on local network |
| 43 | + |
| 44 | +## Key Features |
| 45 | + |
| 46 | +- Send notifications to LaMetric TIME displays |
| 47 | +- Device discovery on local network |
| 48 | +- Multiple device support |
| 49 | + |
| 50 | +## Commit & Pull Request Guidelines |
| 51 | + |
| 52 | +- Conventional Commits: `feat|fix|refactor|build|ci|chore|docs|style|perf|test` |
| 53 | +- Group related changes; avoid bundling unrelated refactors |
| 54 | +- PR review: use `gh pr view` / `gh pr diff`; don't switch branches |
| 55 | + |
| 56 | +## Security Tips |
| 57 | + |
| 58 | +- Never commit API keys |
| 59 | +- Prefer OS keychain; file backend only for headless environments |
| 60 | +- Device API keys should be unique per device |
0 commit comments