Release v0.1.3
🛡️ Config Edit with Validation
gcop config edit now validates your configuration after saving, similar to how visudo works. If your config has syntax errors, you'll see a menu with options:
✗ Config validation failed: TOML parse error at line 3...
? What would you like to do?
> ✎ Re-edit the config file
↩ Restore previous config
⚠ Ignore errors and keep current (dangerous)This prevents accidentally breaking your config and getting locked out.
🔧 Config Recovery
Previously, if your config file was corrupted, you couldn't even run gcop config edit to fix it. Now the config, init, and alias commands use default settings when the config is broken, so you can always recover:
bash
# Even with a broken config, this now works:
gcop config edit🏗️ Code Quality Improvements
Provider Refactoring
Extracted common HTTP request logic into a shared send_llm_request() function:
rust
// Before: Each provider had ~30 lines of duplicate HTTP code
// After: Single function handles all providers
pub async fn send_llm_request<Req, Resp>(...) -> Result<Resp>This reduces code duplication by ~50 lines and makes adding new providers easier.
Better Error Handling
OpenAI provider now returns an explicit error when the API response is empty:
rust
// Before: silently returned empty string
.unwrap_or_default()
// After: clear error message
.ok_or_else(|| GcopError::Llm("OpenAI response contains no choices".to_string()))📦 Installation
bash
cargo install gcop-rsOr build from source:
bash
git clone https://github.com/AptS-1547/gcop-rs.git
cd gcop-rs
cargo build --release