Skip to content

feat: add config file support#6

Merged
clawdeeo merged 9 commits intomainfrom
feat/config
Apr 21, 2026
Merged

feat: add config file support#6
clawdeeo merged 9 commits intomainfrom
feat/config

Conversation

@clawdeeo
Copy link
Copy Markdown
Collaborator

Implements Feature 1 of v0.2.0: Configuration file support.

Changes

New module: src/config.rs

  • struct with TOML deserialization
  • Supports multiple config locations (precedence: env > local > XDG > legacy > defaults)
    • $GITCLAW_CONFIG env var
    • .gitclaw.toml (project-local)
    • ~/.config/gitclaw/config.toml (XDG)
    • ~/.gitclaw.toml (legacy)

Config schema

  • install_dir: Installation directory (default: ~/.gitclaw/bin)
  • github_token: Optional GitHub API token
  • download.show_progress: Show progress bars (default: true)
  • download.prefer_strip: Strip directory components (default: true)
  • download.verify_checksums: Verify checksums (default: true)
  • output.color: Color mode: auto/always/never (default: auto)
  • output.quiet: Suppress output (default: false)
  • output.verbose: Verbose output (default: false)

Tests

  • 10 integration tests covering:
    • Default values
    • Loading from all config locations
    • Config merging/precedence
    • Accessor methods

Verification

  • cargo test: 84 passed, 2 ignored
  • cargo clippy: clean
  • cargo fmt: clean

Ready for review!

- Create src/config.rs with Config struct and Config::load() method
- Support config locations: $GITCLAW_CONFIG, ./.gitclaw.toml,
  ~/.config/gitclaw/config.toml, ~/.gitclaw.toml
- Config schema: install_dir, github_token, download.*, output.*
- Update Cargo.toml: add dirs 5, toml 0.8, atty 0.2
- Update main.rs to load config on startup and merge with CLI args
- Update github.rs and install.rs to use config
- Add comprehensive tests in tests/config.rs (21 tests)
- All tests pass, clippy clean, fmt applied
- Add src/config.rs with Config struct
- Support multiple config locations (env, local, XDG, legacy)
- Config schema: install_dir, github_token, download/output prefs
- Merge configs with proper precedence
- Add unit tests for config loading
- Add src/config.rs with full Config struct
- Support env var, local, XDG, legacy config locations
- Proper Default impls for DownloadConfig, OutputConfig
- 10 integration tests for config loading and merging
- All 84+ tests passing
@airscripts airscripts added the enhancement New feature or request label Apr 21, 2026
@clawdeeo clawdeeo merged commit 58bc984 into main Apr 21, 2026
8 checks passed
@clawdeeo clawdeeo deleted the feat/config branch April 21, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants