2.5 KiB
2.5 KiB
Repository Guidelines
Architecture Overview
- Role: Additional IRC client (not a bot) connected to a soju bouncer with your same nick. Uses a distinct clientId/username suffix for per‑client history.
- Ingestion: Raw IRC via
internal/sojuwith optional CHATHISTORY backfill, quiet hours, and rate limiting for alerts. - Storage: SQLite (
internal/store) for channel logs and metadata. - Notifications: Pushover (
internal/notifier) for mentions and scheduled digests. - Summaries: OpenAI LLM (
internal/summarizer, default gpt‑5) for link and channel summaries. - Web UI:
internal/httpapiserves SSE live view, link cards, inline article summaries, and an on‑demand summary page.
Project Structure
cmd/sojuboy/: entrypoint and service wiringinternal/{soju,store,notifier,summarizer,httpapi,scheduler}: core packages- Root:
Dockerfile,docker-compose.yml,README.md,CHANGELOG.md
Build, Run, and Deploy
- Local:
go build -o sojuboy ./cmd/sojuboyorgo run ./cmd/sojuboy - Docker (Synology‑friendly):
docker compose up --build(exposes8080) - Health:
./sojuboy --health,curl :8080/healthz,curl :8080/ready - Example .env:
SOJU_HOST=hostSOJU_PORT=6697SOJU_TLS=trueIRC_NICK=nickIRC_USERNAME=user/network@sojuboyIRC_PASSWORD=...CHANNELS=#chan1,#chan2NOTIFIER=pushoverPUSHOVER_USER_KEY=...PUSHOVER_API_TOKEN=...LLM_PROVIDER=openaiOPENAI_API_KEY=...DIGEST_CRON=0 0 9 * * *HTTP_TOKEN=longtoken
Coding Style & Naming
- Format:
gofmt -s -w .; lint:go vet ./...; deps:go mod tidy - Indentation: Go uses tabs; YAML/JS use 2 spaces
- Naming: packages lower‑case; exported
CamelCase; filessnake_case.go - Logging: use
slogviainternal/logging; include context
Testing Guidelines
- Use standard
testingwith table‑driven tests; place beside code (*_test.go) - For store tests, use in‑memory DB:
store.Open(ctx, ":memory:") - Run:
go test ./...andgo test -cover ./...
Commits & PRs
- Commits: short, imperative; conventional tags like
feat(ui):,fix(store):,docs:(see history) - PRs: description, linked issues, repro/verification steps; screenshots for Web UI changes
- Update
README.md/CHANGELOG.mdwhen flags, endpoints, or UX change
Security & Config
- Keep secrets in
.env(git‑ignored); never commit API keys - Synology: map
/datavolume; protect UI withHTTP_TOKEN(cookie/Bearer/query); bind127.0.0.1:8080behind DSM Reverse Proxy if desired