Commit Graph

12 Commits

  • feat(store): introduce GitTokenStore for token persistence via Git backend
    - Added `GitTokenStore` to handle token storage and metadata using Git as a backing storage.
    - Implemented methods for initialization, save, retrieval, listing, and deletion of auth files.
    - Updated `go.mod` and `go.sum` to include new dependencies for Git integration.
    - Integrated support for Git-backed configuration via `GitTokenStore`.
    - Updated server logic to clone, initialize, and manage configurations from Git repositories.
    - Added helper functions for verifying and synchronizing configuration files.
    - Improved error handling and contextual logging for Git operations.
    - Modified Dockerfile to include `config.example.yaml` for initial setup.
    - Added `gitCommitter` interface to handle Git-based commit and push operations.
    - Configured `Watcher` to detect and leverage Git-backed token stores.
    - Implemented `commitConfigAsync` and `commitAuthAsync` methods for asynchronous change synchronization.
    - Enhanced `GitTokenStore` with `CommitPaths` method to support selective file commits.
  • feat(claude-executor): add ZSTD decoding support for Claude executor responses
    - Integrated ZSTD decompression via `github.com/klauspost/compress` for responses with "zstd" content-encoding.
    - Added helper `hasZSTDEcoding` to detect ZSTD-encoded responses.
    - Updated response handling logic to initialize and use a ZSTD decoder when necessary.
    
    refactor(api-handlers): split streaming and non-streaming response handling
    
    - Introduced `handleNonStreamingResponse` for processing non-streaming requests in `ClaudeCodeAPIHandler`.
    - Improved code clarity by separating streaming and non-streaming logic.
    
    fix(service): remove redundant token refresh interval assignment logic in `cliproxy` service.
  • feat(logging): integrate logrus with custom Gin middleware for enhanced request logging and recovery
    - Added `GinLogrusLogger` for structured request logging using Logrus.
    - Implemented `GinLogrusRecovery` to handle panics and log stack traces.
    - Configured log rotation using Lumberjack for efficient log management.
    - Replaced Gin's default logger and recovery middleware with the custom implementations.
  • Update internal module imports to use v5 package path
    - Updated all `github.com/luispater/CLIProxyAPI/internal/...` imports to point to `github.com/luispater/CLIProxyAPI/v5/internal/...`.
    - Adjusted `go.mod` to specify `module github.com/luispater/CLIProxyAPI/v5`.
  • Refactor translator packages for OpenAI Chat Completions
    - Renamed `openai` packages to `chat_completions` across translator modules.
    - Introduced `openai_responses_handlers` with handlers for `/v1/models` and OpenAI-compatible chat completions endpoints.
    - Updated constants and registry identifiers for OpenAI response type.
    - Simplified request/response conversions and added detailed retry/error handling.
    - Added `golang.org/x/crypto` for additional cryptographic functions.
  • Add file watcher for dynamic configuration and client reloading
    - Introduced `Watcher` for monitoring updates to the configuration file and authentication directory.
    - Integrated file watching into `StartService` to handle dynamic changes without restarting.
    - Enhanced API server and handlers to support client and configuration updates.
    - Updated `.gitignore` to include `docs/` directory.
    - Modified go dependencies to include `fsnotify` for the file watcher.