|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure |
| 4 | + |
| 5 | +- `cmd/strawpoll/`: CLI entrypoint |
| 6 | +- `internal/`: implementation |
| 7 | + - `cmd/`: command routing (kong CLI framework) |
| 8 | + - `api/`: StrawPoll v3 API client (rate limiter, retry logic) |
| 9 | + - `auth/`: API key management (keyring) |
| 10 | + - `config/`: YAML config (poll defaults, keyring settings) |
| 11 | + - `output/`: formatters (table, JSON, TSV) |
| 12 | + - `tui/`: Bubbletea/huh interactive wizards |
| 13 | +- `bin/`: build outputs |
| 14 | + |
| 15 | +**Note**: Embeds timezone data for consistent time handling. |
| 16 | + |
| 17 | +## Build, Test, and Development Commands |
| 18 | + |
| 19 | +- `make build`: compile to `bin/strawpoll` |
| 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/strawpoll-cli` + gofumpt) |
| 27 | +- Output: keep stdout parseable (`--json`, `--plain` for TSV); send human hints/progress to stderr |
| 28 | +- Linting: golangci-lint v2.8.0 with project config |
| 29 | +- TUI: use Charmbracelet ecosystem (bubbletea + huh for forms) |
| 30 | + |
| 31 | +## Testing Guidelines |
| 32 | + |
| 33 | +- Unit tests: stdlib `testing` |
| 34 | +- 14 test files; comprehensive coverage: |
| 35 | + - API (clients, polls, URL parsing, rate limiting, transport) |
| 36 | + - Config (paths, config) |
| 37 | + - Auth (keyring) |
| 38 | + - Output (formatting, tables) |
| 39 | + - TUI (terminal detection, wizards) |
| 40 | + - Commands (version, exit) |
| 41 | +- CI gate: fmt-check, lint, test |
| 42 | + |
| 43 | +## Config & Secrets |
| 44 | + |
| 45 | +- **Keyring**: 99designs/keyring for API key storage |
| 46 | +- **Env var**: `STRAWPOLL_API_KEY` as alternative |
| 47 | +- **Config file**: `~/.config/strawpoll/config.yaml` |
| 48 | + - Poll defaults: `dupcheck`, `results_visibility`, `privacy`, `comments`, `vpn`, `participants`, `edit_perms` |
| 49 | + - `keyring_backend`: backend preference |
| 50 | + |
| 51 | +## Key Commands |
| 52 | + |
| 53 | +- `poll`: create/get/list/update/delete polls; results; reset votes |
| 54 | +- `meeting`: meeting polls (availability scheduling) |
| 55 | +- `ranking`: ranked-choice polls |
| 56 | +- Interactive wizards for poll/meeting creation |
| 57 | +- Global flags: `--json`, `--plain` (TSV), `--no-color`, `--copy`, `--open` |
| 58 | + |
| 59 | +## API Features |
| 60 | + |
| 61 | +- Rate limiter: 10 req/sec token bucket |
| 62 | +- Retry logic: exponential backoff (3 retries) |
| 63 | +- Poll types: `multiple_choice`, `meeting`, `ranking` |
| 64 | +- Max 30 options per poll |
| 65 | + |
| 66 | +## Commit & Pull Request Guidelines |
| 67 | + |
| 68 | +- Conventional Commits: `feat|fix|refactor|build|ci|chore|docs|style|perf|test` |
| 69 | +- Group related changes; avoid bundling unrelated refactors |
| 70 | +- PR review: use `gh pr view` / `gh pr diff`; don't switch branches |
| 71 | + |
| 72 | +## Security Tips |
| 73 | + |
| 74 | +- Never commit API keys |
| 75 | +- Prefer OS keychain; env var for CI/headless |
| 76 | +- Rate limiting protects against API abuse |
0 commit comments