Skip to content

Commit a24f2b7

Browse files
committed
feat: Agent and gitignore updated
feat: agent md updated
1 parent 68826ab commit a24f2b7

6 files changed

Lines changed: 1023 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ playwright-report/
4343
test-results/
4444
playwright/.cache/
4545
server.log
46+
/main

AGENTS.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,25 @@ Use `make verify` (runs `scripts/verify.sh`) to automatically select checks base
5252
| Structured Logging | `slog.Info("msg", "key", value)` |
5353
| Use sqlc Queries | Always use sqlc-generated queries, not raw SQL or JSON operations |
5454

55+
## Layering Guide (Repository → Service → Transport)
56+
57+
**Repository (Persistence Gateway)**
58+
- Abstracts storage (SQL/Redis/etc); returns **domain structs only**
59+
- No business logic; `context.Context` first argument
60+
- Never leak DB types (`sql.NullString`, `pgtype.Text`)
61+
62+
**Service (Business Logic Core)**
63+
- Orchestrates rules + repositories; no `net/http` or protocol deps
64+
- Map storage errors to domain errors (don’t return raw SQL errors)
65+
- Unit-testable without infra
66+
67+
**Transport (HTTP / RPC handlers)**
68+
- Decode/validate → call Service → map domain errors → encode response
69+
- No business logic, no direct repository calls
70+
- For Chi handlers, use `github.com/go-chi/render` for JSON + errors
71+
72+
**Implementation order:** Service interface → Repository query → Service logic → Transport handler.
73+
5574
## Local Auth Storage (Counterspell)
5675

5776
- **SQLite (local):** `settings.machine_jwt` and `settings.machine_id`

0 commit comments

Comments
 (0)