1# Fantasy Development Guide
2
3## Commands
4
5- **Build**: `go build ./...`
6- **Test all**: `task test` or `go test ./... -count=1 -timeout=30m`
7- **Test single**: `go test -run TestName ./package -v`
8- **Lint**: `task lint` or `golangci-lint run`
9- **Lint fix**: `task lint:fix`
10- **Format**: `task fmt` (uses `gofumpt`, not `gofmt`)
11
12## Style Notes
13
14- Prefer `cmp.Or` for defaults
15- Struct tags `json`, `description`, `enum` drive schema generation
16- `charm.land/x/vcr` for HTTP test recording (not go-vcr)
17
18## Project Layout
19
20- `/` — Core package `fantasy`: Provider, LanguageModel, Agent, Content, Tool, errors, retry
21- `/providers/{openai,anthropic,google,bedrock,azure,openrouter,openaicompat,vercel,kronk}`
22- `/object` — Typed structured outputs: `object.Generate[T]`, `object.Stream[T]`
23- `/schema`, `/jsonrepair` — JSON schema generation and repair utilities
24- `/providertests` — Integration tests with VCR cassettes in `testdata/`
25
26## Testing
27
28- Env vars: `FANTASY_<PROVIDER>_API_KEY`, loaded from `.env` via godotenv
29- VCR recorder injected as `http.Client` transport