Better Beeper CLI for Agents
- Go 1.24; one dependency — the Beeper SDK
github.com/beeper/desktop-api-go/v5, isolated ininternal/beeper - CLI: hand-rolled dispatch in
internal/cli, stdlibflagper subcommand - Tooling:
go vet,gofmt,go test
Use just as the task runner:
just check— run all checks (just-fmt-check + loc-check + dir-check + fmt-check + lint + test)just lint—go vet ./...just fmt— format withgofmtjust fmt-check— fail if any file is unformattedjust test—go test ./...just smoke— live smoke test against Beeper Desktop (needsBEEPER_ACCESS_TOKEN)just run -- <args>— run the CLIjust build—go build ./...just build-release— stripped release binary intobin/just loc-check— check file lengths (thresholds in.quality.json)just dir-check— check files per directory (thresholds in.quality.json)just just-fmt-check— verify Justfile formattingjust update-scaffold— pull updates from the cookiecutter template
main.go # thin entry: builds the registry, calls cli.Main
internal/cli/ # dispatch, global flags, help, error→exit
internal/command/ # one package per verb-group (chats, messages, count, open, pick, send, takeout, accounts, contacts, doctor, config, upgrade, agent, watch, auth, meta)
internal/beeper/ # SDK adapter (only SDK importer) + beepertest fake
internal/... # domain, ids, render, primer, apperr, settings, authcache (see CLAUDE.md)
go.mod / Justfile # module config / task runner
- Stdlib-first; add dependencies only with a reason (
go get+go mod tidy) mainstays thin; logic lives in functions returningerror- Keep functions small (5-10 lines target, 20 max)
- Prefer explicit, readable code over cleverness
- Handle errors at boundaries; let unexpected errors surface (no silent
_)
Run after every change: just check
Runs: just-fmt-check + loc-check + dir-check + fmt-check + lint + test.
Step-by-step alternative:
just fmtjust lintjust test
gofmt -w .— format all Go filesgo mod tidy— sync go.mod/go.sum with imports
- Add a global flag: parse in
internal/cli/globals.go, add toGlobals, thread throughDeps - Add a subcommand flag: a
flag.NewFlagSetinside the command'srun<Sub>(e.g.chats stale --days,auth login --ttl) - Add a dependency:
go get <module>thengo mod tidy - Add a package: new dir with
package <name>, import via module path
- Test files:
*_test.gonext to the code,func TestXxx(t *testing.T) - Run a single test:
go test -run TestName ./...
- Do not deploy, publish, or push
- Do not add dependencies or edit
go.mod's module path without asking