⚠️ BRANCH PROTECTION: Never commit directly to main. A PreToolUse hook enforces this automatically.
oastools is a Go CLI for OpenAPI Specification files. Validates, fixes, joins, converts, diffs, walks, generates, and builds OAS 2.0-3.2.
- Emojis welcome in PR descriptions and release notes, but not required in code or docs
- GitHub formatting: Bare hashes/issues auto-link; backticks break linking
- Good:
Fixed in commit 1f3eb93→ clickable - Bad:
Fixed in commit \1f3eb93`` → not clickable
- Good:
make checkbefore committing- Conventional commits:
feat(parser): add feature - See WORKFLOW.md for PR/release process
- See AGENTS.md for agent workflow
| Package | Purpose |
|---|---|
| cmd/oastools/ | CLI entry point |
| parser/ | Parse YAML/JSON OAS, resolve refs, detect versions |
| validator/ | Validate against spec schema |
| fixer/ | Auto-fix common errors |
| joiner/ | Join multiple OAS files |
| converter/ | Convert between OAS versions |
| differ/ | Compare specs, detect breaking changes |
| httpvalidator/ | Runtime HTTP validation |
| generator/ | Generate Go client/server |
| builder/ | Programmatic spec construction |
| overlay/ | Apply Overlay transformations |
| walker/ | Traverse with typed handlers |
- Format preserved: JSON/YAML auto-detected from extension or content
- Use constants:
httputil.MethodGet,severity.SeverityError - Always run
go_diagnosticsafter edits—hints improve perf 5-15% - Favor fixing immediately over deferring issues
- Deep copy: Use generated
doc.DeepCopy()methods, never JSON marshal/unmarshal (losesinterface{}types, dropsjson:"-"fields) make checkbefore pushing — not justgo test; catches lint, formatting, and trailing whitespacedocs/is mixed source + generated: Source files (index.md,mcp-server.md,cli-reference.md, etc.) are edited directly indocs/. Generated files (docs/packages/,docs/examples/) come from{package}/deep_dive.mdandexamples/*/README.md— see.claude/docs/docs-website.md- MCP config via env vars: The MCP server reads
OASTOOLS_*env vars for configuration (cache TTLs, walk limits, join strategies, etc.). The Go MCP SDK doesn't supportinitializationOptions, so env vars are used instead. MCP clients set these via theirenvfield in server config.
Default behavior: Act as an orchestrator, not an implementer.
| Task Type | Agent |
|---|---|
| Research/exploration | general-purpose |
| Architecture/planning | architect |
| Implementation/coding | developer |
| Code review/security | maintainer |
| Release/deployment | devops-engineer |
- Simple questions answerable from context
- Clarifying user intent
- Synthesizing agent results
- Coordinating multi-agent workflows
| Topic | File |
|---|---|
| OAS concepts & pitfalls | .claude/docs/oas-concepts.md |
| Error handling patterns | .claude/docs/error-handling.md |
| Testing requirements | .claude/docs/testing-requirements.md |
| Benchmark guide | .claude/docs/benchmark-guide.md |
| gopls workflow | .claude/docs/gopls-workflow.md |
| New package checklist | .claude/docs/new-package-checklist.md |
| Make commands | .claude/docs/make-commands.md |
| Docs website | .claude/docs/docs-website.md |
- Module:
github.com/erraggy/oastools - Minimum Go: 1.25