feat(cmd): wire auth/run dispatcher + demo docs

main.go dispatches `tapir auth` (interactive OAuth → persist refresh token via
SecretStore) and `tapir run` (wire YouTube source + local summarizer + store
sink, build engine, run the dedup-aware loop). Config-driven so live creds plug
in at demo time; SIGINT stops the loop cleanly. Block kept minimal so Worker E's
list/show cases union cleanly at merge.

Add .env.example documenting every TAPIR_* var and a README demo runbook. Pin
the summarizer alias-as-config decision and record the max_tokens fix in
docs/homelab-integration.md (clears two `confirm` items).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-02 21:03:21 +02:00
co-authored by Claude Opus 4.8
parent 5645c2c012
commit 61796db16b
4 changed files with 171 additions and 15 deletions
+33
View File
@@ -32,6 +32,39 @@ intent is version-controlled and the build has something to be checked against.
- **Trunk-Based Development.** Commit directly to `main`, one logical change per commit, every
commit deployable (see ADR-009). CI is the quality gate.
## Running the Stage-0 demo
Tapir runs on **your own** YouTube account: authorize once, then run the
watch→summarize→deliver loop. All configuration is via `TAPIR_*` environment
variables — copy [`.env.example`](.env.example) to `.env` and fill it in (no
secrets are committed; at demo time source them from op, e.g. `op run -- ...`).
```sh
# 1. configure (UUID user id, gateway URL+key, Postgres DSN, YouTube OAuth app,
# summarizer model). See .env.example for every variable.
cp .env.example .env && $EDITOR .env
set -a && . ./.env && set +a # export them into the shell
go build -o bin/tapir ./cmd/tapir
# 2. one-time: authorize YouTube. Opens a consent URL, captures the redirect on
# TAPIR_OAUTH_REDIRECT_ADDR, and stores the refresh token via the SecretStore
# (a 0600 file at Stage 0). The token is never logged.
./bin/tapir auth
# 3. run: detect new videos across your subscriptions, summarize, deliver to the
# store. Unset TAPIR_POLL_INTERVAL = single pass; set it (e.g. 15m) to loop.
./bin/tapir run
```
Live prerequisites at demo time: the LiteLLM gateway reachable
(`TAPIR_GATEWAY_URL` + a valid key — resolve from op, the documented
`sk-local-123` is stale), a Postgres DSN (`TAPIR_DB_DSN`, migrations apply on
first connect), and a registered YouTube OAuth client whose authorized redirect
URI matches `TAPIR_OAUTH_REDIRECT_ADDR`. The summarizer model
(`TAPIR_SUMMARIZER_MODEL`, default `koala/phi4-mini`) is overridable; pick the
final alias when the gateway is reachable (see `docs/homelab-integration.md`).
## Conventions
Reuses homelab conventions: Go, Dex for identity, ESO + 1Password for secrets, Postgres for