Skip to content

Release v0.2.0

⚙️ Configuration-Driven Architecture Refactoring

This release migrates all previously hardcoded constants to the configuration system, allowing users to customize various parameters according to their needs.

New Configuration Options

1. Network Configuration [network]

Control HTTP request behavior:

toml
[network]
request_timeout = 120    # HTTP request timeout (seconds)
connect_timeout = 10     # HTTP connection timeout (seconds)
max_retries = 3          # Max retry attempts on API request failure
retry_delay_ms = 1000    # Initial retry delay (milliseconds, exponential backoff)

2. File Configuration [file]

Control file size limits:

toml
[file]
max_size = 10485760      # Max file size (bytes, default 10MB)

3. LLM Parameter Configuration

Each provider can now explicitly configure max_tokens and temperature:

toml
[llm.providers.claude]
api_key = "sk-ant-..."
model = "claude-sonnet-4-5-20250929"
max_tokens = 2000        # Max response tokens
temperature = 0.3        # Generation temperature

4. Commit Retry Count

toml
[commit]
max_retries = 10         # Max manual retry attempts

Architecture Improvements

Removed constants.rs

No longer using a centralized constants file. Each module manages its own default values:

Original ConstantNew Location
DEFAULT_MAX_TOKENSsrc/llm/provider/base.rs
DEFAULT_TEMPERATUREsrc/llm/provider/base.rs
ERROR_PREVIEW_LENGTHsrc/llm/provider/base.rs
MAX_FEEDBACK_LENGTHsrc/ui/prompt.rs
Prompt templatessrc/llm/prompt.rs

Configuration Priority

All parameters support config file overrides while maintaining backward compatibility:

  1. Config file value (if set)
  2. Default value (if not set)

Breaking Changes

⚠️ API Changes (only affects library users):

rust
// Before
let repo = GitRepository::open()?;

// Now
let repo = GitRepository::open(None)?;                    // Use default config
let repo = GitRepository::open(Some(&config.file))?;      // Use custom config

Upgrade Notes

Upgrading from v0.1.6 requires no configuration changes.

All new configuration options have default values matching previous hardcoded values:

  • network.request_timeout = 120
  • network.connect_timeout = 10
  • network.max_retries = 3
  • network.retry_delay_ms = 1000
  • file.max_size = 10485760 (10MB)
  • commit.max_retries = 10

If you need to customize, add the corresponding configuration to ~/.config/gcop/config.toml.

Configuration Example

Complete configuration example:

toml
[llm]
default_provider = "claude"

[llm.providers.claude]
api_key = "sk-ant-..."
model = "claude-sonnet-4-5-20250929"
max_tokens = 4000        # Increase response length
temperature = 0.5        # Slightly increase creativity

[commit]
max_retries = 5          # Reduce retry count

[network]
request_timeout = 60     # Shorten timeout
max_retries = 5          # Increase auto retry count

[file]
max_size = 5242880       # Limit to 5MB

📦 Installation

bash
cargo install gcop-rs

Or build from source:

bash
git clone https://github.com/AptS-1547/gcop-rs.git
cd gcop-rs
cargo build --release

📚 Documentation

Feedback & Contributions

If you have any issues or suggestions, please submit an Issue.