# Dolly — like `apt`, but for GitHub. Named after the sheep.

Most developer tools you actually use live on GitHub, not in your distro's package manager — or if they do, the distro version is two years stale. Dolly is a CLI that clones, builds, and installs tools straight from GitHub source, then keeps them up to date.

The name comes from Dolly the Finn-Dorset, the world's first cloned mammal (Scotland, 1996).

## Quick start

https://github.com/user-attachments/assets/c01aec80-dc9b-4580-bb39-eaebb3b6ee41

```sh
# From crates.io (recommended)
cargo install dolly-cli

# From source:
cargo install --git https://github.com/michal-pielka/dolly
```

Write a recipe at `~/.dolly/recipes/<repository>.toml`:

```toml
[package]
owner = "junegunn"
repository = "fzf"
description = "A command-line fuzzy finder"

[build]
steps = ["go build ."]
output = "fzf"
```

Then:

```sh
dolly install junegunn/fzf
```

Dolly clones the repository into `~/.dolly/repositories/fzf/`, runs `go build .`, and copies the resulting `fzf` binary to `~/.local/bin/fzf`. Re-runs are idempotent.

## Commands

| Command | What it does |
|---|---|
| `dolly install <owner/repo>` | Clone, build, install |
| `dolly update [<repo>] [--dry-run]` | Pull, rebuild, replace; or check upstream |
| `dolly remove <repo> [--keep-repo]` | Delete the binary (and optionally the clone) |
| `dolly list` | List installed packages |
| `dolly info <repo>` | Show recipe, install path, current commit |
| `dolly clone <owner/repo>` | Just clone — no build, no install |

## Recipe format

Required: `[package].owner`, `[package].repository`, `[build].steps`, `[build].output`. Optional: `[package].description`.

```toml
[package]
owner = "BurntSushi"
repository = "ripgrep"

[build]
steps = ["cargo build --release"]
output = "target/release/rg"
```

`steps` runs each command via `sh -c` from the cloned repo's root, with full shell features (`&&`, pipes, env vars). `output` is the path to the built binary, relative to the repo root; its basename becomes the installed binary's filename. Unknown fields and malformed TOML fail loudly with a line number.

For multi-step builds, just list each command as its own entry — they're run sequentially, and the first failure aborts:

```toml
[package]
owner = "htop-dev"
repository = "htop"
description = "Interactive process viewer"

[build]
steps = [
  "./autogen.sh",
  "./configure",
  "make",
]
output = "htop"
```

## Layout

```
~/.dolly/
  repositories/<repository>/    # cloned source trees
  recipes/<repository>.toml     # user-authored recipes
~/.local/bin/<binary>           # installed binaries (or $XDG_BIN_HOME)
```

The filesystem is the source of truth — there's no separate state file to drift out of sync.

## TODO

Plans for future versions:

- **Crash-safe updates** — atomic binary swap with `.bak`, so a failed mid-update never leaves a broken tool on PATH.
- **Better recipe-not-found UX** — copy-pasteable starter template instead of a bare error.
- **Auto-detection** — recognise Cargo / Go / Make / CMake repos and generate a starter recipe automatically.
- **Professional JS / Python tool handling** — first-class install flows for non-compiled tools instead of treating everything like a built binary.
- **Community registry** — pull recipes from a shared GitHub repo so common tools work without hand-writing TOML.
- **`--quiet` build mode** — capture build output, replay only on failure.
- **Shell completions** via `clap_complete`.
- **`dolly doctor`** — check for stale clones, missing binaries, broken recipes.
- **Rollback** — restore a `.bak` binary from an earlier version.

## License

MIT.
