From 522a4f81398829e9e9e061aea7c53b5590b2c0a0 Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Sat, 14 Mar 2026 21:11:22 -0400 Subject: [PATCH] docs(agents): minor AGENTS.md updates --- AGENTS.md | 29 +++++++++++++++++++++++++++++ CRUSH.md | 29 ----------------------------- 2 files changed, 29 insertions(+), 29 deletions(-) create mode 100644 AGENTS.md delete mode 100644 CRUSH.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000000000000000000000000000000000000..5779b3583c8b3356b34a4d393cf123e996dd94ca --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,29 @@ +# Fantasy Development Guide + +## Commands + +- **Build**: `go build ./...` +- **Test all**: `task test` or `go test ./... -count=1 -timeout=30m` +- **Test single**: `go test -run TestName ./package -v` +- **Lint**: `task lint` or `golangci-lint run` +- **Lint fix**: `task lint:fix` +- **Format**: `task fmt` (uses `gofumpt`, not `gofmt`) + +## Style Notes + +- Prefer `cmp.Or` for defaults +- Struct tags `json`, `description`, `enum` drive schema generation +- `charm.land/x/vcr` for HTTP test recording (not go-vcr) + +## Project Layout + +- `/` — Core package `fantasy`: Provider, LanguageModel, Agent, Content, Tool, errors, retry +- `/providers/{openai,anthropic,google,bedrock,azure,openrouter,openaicompat,vercel,kronk}` +- `/object` — Typed structured outputs: `object.Generate[T]`, `object.Stream[T]` +- `/schema`, `/jsonrepair` — JSON schema generation and repair utilities +- `/providertests` — Integration tests with VCR cassettes in `testdata/` + +## Testing + +- Env vars: `FANTASY__API_KEY`, loaded from `.env` via godotenv +- VCR recorder injected as `http.Client` transport diff --git a/CRUSH.md b/CRUSH.md deleted file mode 100644 index ad5079839ef80b9e3b1bd752198d6bd23b2d95cf..0000000000000000000000000000000000000000 --- a/CRUSH.md +++ /dev/null @@ -1,29 +0,0 @@ -# CRUSH.md - Fantasy AI SDK - -## Build/Test/Lint Commands -- **Build**: `go build ./...` -- **Test all**: `task test` or `go test ./... -count=1` -- **Test single**: `go test -run TestName ./package -v` -- **Test with args**: `task test -- -v -run TestName` -- **Lint**: `task lint` or `golangci-lint run` -- **Format**: `task fmt` or `gofmt -s -w .` -- **Modernize**: `task modernize` or `modernize -fix ./...` - -## Code Style Guidelines -- **Package naming**: lowercase, single word (ai, openai, anthropic, google) -- **Imports**: standard library first, then third-party, then local packages -- **Error handling**: Use custom error types with structured fields, wrap with context -- **Types**: Use type aliases for function signatures (`type Option = func(*options)`) -- **Naming**: CamelCase for exported, camelCase for unexported -- **Constants**: Use const blocks with descriptive names (ProviderName, DefaultURL) -- **Structs**: Embed anonymous structs for composition (APICallError embeds *AIError) -- **Functions**: Return error as last parameter, use context.Context as first param -- **Testing**: Use testify/assert, table-driven tests, recorder pattern for HTTP mocking -- **Comments**: Godoc format for exported functions, explain complex logic inline -- **JSON**: Use struct tags for marshaling, handle empty values gracefully - -## Project Structure -- `/ai` - Core AI abstractions and agent logic -- `/openai`, `/anthropic`, `/google` - Provider implementations -- `/providertests` - Cross-provider integration tests with VCR recordings -- `/examples` - Usage examples for different patterns \ No newline at end of file