Releases: marvai-dev/claude-code-go
Releases · marvai-dev/claude-code-go
Release v0.3.1
v0.2.0: Python SDK Alignment & Enhanced Buffer Management
🎉 Major Release: Python SDK Alignment & Enhanced Buffer Management
This release addresses buffer size issues and aligns the Go SDK with the official Python SDK for better cross-language consistency.
✨ What's New
🐍 Python SDK Alignment
- New
Query()method - Matches Python SDK'squery()function for consistency QueryOptionsstruct - Aligned with PythonClaudeCodeOptions- Streaming via channels - Go's equivalent to Python's
async foriteration - Exact field names -
max_turns,system_prompt,cwd, etc. match Python SDK - Permission modes - Support for
"acceptEdits","rejectAll", and"ask"
💾 Enhanced Buffer Management
- Configurable limits - Default 10MB stdout / 1MB stderr with full customization
- Automatic truncation - Graceful handling when buffer limits are exceeded
- Timeout protection - 30-second default with context cancellation support
- Health monitoring - Real-time buffer system health checks and metrics
- Recovery mechanisms - Automatic fallback buffers and retry logic
- No more OOM - Prevents unbounded memory growth from large Claude outputs
📝 Example: Python SDK Aligned Usage
// Python-style API in Go
messageCh, err := client.Query(ctx, "Write a hello world program",
claude.QueryOptions{
MaxTurns: 3,
SystemPrompt: "You're a helpful coding assistant",
AllowedTools: []string{"Write", "Read", "Bash"},
PermissionMode: "acceptEdits",
})
for message := range messageCh {
fmt.Println(message.Content)
}📊 Buffer Configuration
opts := &claude.QueryOptions{
BufferConfig: &buffer.Config{
MaxStdoutSize: 5 * 1024 * 1024, // 5MB
MaxStderrSize: 1 * 1024 * 1024, // 1MB
BufferTimeout: 60 * time.Second,
EnableTruncation: true,
},
}🔄 Backward Compatibility
All existing APIs are maintained:
RunPrompt(),RunPromptCtx()continue to workStreamPrompt()remains unchanged- Existing code requires no modifications
📚 Documentation
- CLAUDE.md - SDK alignment guide for contributors
- Buffer Management Guide - Comprehensive buffer usage
- Python SDK Aligned Example - New API patterns
- Buffer Usage Example - Buffer customization
🔧 Installation
go get github.com/marvai-dev/claude-code-go@v0.2.0🚀 Migration Guide
- New users: Start with the
Query()method for Python SDK alignment - Existing users: Your code continues to work; migrate at your convenience
- Buffer issues: Configure
BufferConfiginQueryOptionsorRunOptions
📈 Performance
- Memory usage capped by configurable limits
- Streaming performance improved with buffered readers
- Health monitoring prevents cascade failures
- Automatic recovery reduces error rates
🙏 Acknowledgments
This release was developed to address community feedback about memory issues and maintain alignment with Anthropic's official SDKs.
Full Changelog: v0.1.15...v0.2.0
v0.1.14
Fix module path from github.com/lancekrogers/claude-code-go to github.com/marvai-dev/claude-code-go
v0.1.13
Fork of claude-code-go