This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
- Build:
cargo build - Run tests:
cargo test - Run a specific test:
cargo test test_name - Run end-to-end tests:
cargo test --test end_to_end_tests - Run gitopolis tests:
cargo test --test gitopolis_tests
- Run all lints:
./lint.sh(runs cargo fmt, clippy with harsh settings, cargo deny license check, and yamllint for GitHub workflows) - Format code:
cargo fmt - Run clippy:
./clippy-harsh.shorcargo clippy --all-targets --all-features -- -D warnings - Check licenses:
cargo deny check licenses - Check unused dependencies:
cargo machete
- Install CI tools locally:
./ci-tool-setup.sh(installs cargo-deny and yamllint) - Upgrade dependencies:
./upgrades.sh(upgrades both Rust version and crate dependencies)
Gitopolis is a CLI tool for managing multiple git repositories, built in Rust with a clean separation of concerns:
- main.rs: CLI interface using clap, bridges between console and logic, injects dependencies
- lib.rs: Module aggregation point for the library
- gitopolis.rs: Core business logic with injected dependencies (storage, git operations, stdout)
- repos.rs: Domain models for repository state management
- exec.rs: Command execution across multiple repositories
- storage.rs: Trait for state persistence (currently using TOML file
.gitopolis.toml) - git.rs: Trait for git operations (using git2 crate)
- End-to-end tests (
tests/end_to_end_tests.rs): Test complete workflows with real file system and git repos - Unit tests (
tests/gitopolis_tests.rs): Test core logic with mocked dependencies (storage, git)
- Dependency injection through traits for testability (Storage, Git traits)
- Clean separation between CLI parsing and business logic
- State management through
.gitopolis.tomlfile with TOML serialization - Command pattern for different operations (add, remove, exec, tag, clone, list)
- The tool uses
git2crate for git operations with vendored OpenSSL - Windows has special handling for glob expansion (not done by shell)
- Supports multiple git remotes per repository
- Rust version is pinned in
.tool-versionsand used by CI workflows