```
_ _ _
__ _ __ _ ___ _ __ | |_ __ _(_) |_
/ _` |/ _` |/ _ \ '_ \| __| / _` | | __|
```
# agent-git
[](https://crates.io/crates/agent-git)
[](LICENSE)
[](https://github.com/exisz/agent-git/actions/workflows/ci.yml)
**A git wrapper that tracks cloned repos and prevents duplicate clones.**
---
## Why?
You've cloned the same repo twice. Maybe three times. They're scattered across `~/projects`, `~/work`, `~/tmp`, and that random folder you made last Tuesday.
- π "Where did I clone that repo?"
- ποΈ "Is this a duplicate?"
- π "I have 200 repos and no idea where half of them are"
**agent-git** wraps your `git` command transparently. Every `git clone` is intercepted and tracked. Try to clone something you already have? It tells you where it is instead of wasting your disk space.
## Install
```bash
cargo install agent-git
```
## Quick Start
```bash
# Install the alias (wraps git command)
agent-git alias install
source ~/.zshrc
# Now git clone is tracked automatically!
git clone https://github.com/user/repo
# Try cloning again β blocked!
git clone https://github.com/user/repo
# Error: Already cloned at /Users/you/projects/repo
# See all tracked repos
git list
# Find where a repo is
git whereis user/repo
```
## Commands
| `agent-git alias install` | Install shell alias (wraps `git`) |
| `agent-git alias uninstall` | Remove shell alias |
| `git clone <url>` | Clone with tracking (via alias) |
| `git list` | List all tracked repos |
| `git whereis <query>` | Find where a repo is cloned |
| `git scan [dir]` | Scan directory for existing repos and track them |
| `git status` | Passthrough to real git (all non-agent commands work normally) |
## Comparison
| Transparent git wrapper | β
| β (separate command) | β (separate command) | β |
| Duplicate prevention | β
| β | β | β |
| Clone tracking | β
| β
(enforced paths) | β
| β
|
| Free directory structure | β
| β (ghq root required) | β | β
|
| Repo search | β
| β
| β
| β |
| Existing repo scanning | β
| β | β | β |
| Shell alias approach | β
| β | β | β |
| Zero behavior change | β
| β | β | β |
**Key difference:** `ghq` and others force you into their directory structure. `agent-git` lets you clone wherever you want β it just remembers where everything went.
## How It Works
```
ββββββββββββββββ βββββββββββββββββ ββββββββββββββββ
β git clone ββββββΆβ agent-git ββββββΆβ real git β
β (alias) β β intercept β β clone β
ββββββββββββββββ βββββββββ¬ββββββββ ββββββββ¬ββββββββ
β β
βββββββββΌββββββββ ββββββββΌββββββββ
β Check TOML β β Track new β
β registry β β clone path β
βββββββββββββββββ ββββββββββββββββ
```
1. **Shell alias** β `agent-git alias install` adds a function to your shell that routes `git` through `agent-git`
2. **Transparent proxy** β Non-clone commands pass straight through to real `git`
3. **Clone interception** β `git clone` checks the TOML registry first. Already cloned? Error with location. New? Clone normally and register.
4. **TOML registry** β `~/.agent-git/repos.toml` stores all tracked repos
## Configuration
Registry lives at `~/.agent-git/repos.toml`:
```toml
[[repos]]
url = "https://github.com/user/repo"
path = "/Users/you/projects/repo"
cloned_at = "2025-01-15T10:30:00Z"
```
## License
[MIT](LICENSE) Β© 2025 Exis