Skip to content

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

git-untangle

Git is the execution substrate, Rust owns the invariants, and the LLM proposes semantic graph edits.

git-untangle decomposes a large or tangled Git commit—or a multi-commit range (A..B, A...B)—into an ordered DAG of coherent, atomic operations, optionally refined by an LLM and verified via intermediate builds, while guaranteeing byte-for-byte final tree equivalence (HEAD^{tree} == tip^{tree}).

Installation

Prebuilt Release (Linux, macOS, Windows / Git Bash)

curl -fsSL https://raw.githubusercontent.com/SimiaCryptus/git-untangle/main/install.sh | sh

The installer detects your OS and CPU architecture, downloads the latest GitHub release, verifies its SHA-256 checksum, and installs the binaries into ~/.local/bin (override with GIT_UNTANGLE_INSTALL_DIR or pin a release with GIT_UNTANGLE_VERSION=v0.1.0).

It is also safe to source directly in bash or zsh so ~/.local/bin is added to your current shell's PATH immediately:

source <(curl -fsSL https://raw.githubusercontent.com/SimiaCryptus/git-untangle/main/install.sh)

From Source (Cargo)

# Optional: build the embedded GitScope server UI bundle before installing (see https://github.com/SimiaCryptus/gitscope)
(cd gitscope && npm ci && npm run build:server)

cargo install --path crates/commit-untangle-cli

This installs git-untangle, git-chat, git-mcs, git-review, and git-scope onto PATH. Because Git automatically discovers git-* executables on PATH, you can invoke them immediately as Git subcommands:

git untangle HEAD --no-llm
git mcs HEAD --model anthropic::claude-sonnet-4-5
git review start security-audit
git scope
git chat untangle main...feature --no-llm
git chat status   # ordinary Git commands forward transparently to `git`

Shell Completions & Manpages

# Bash
git-untangle --generate-completions bash > ~/.local/share/bash-completion/completions/git-untangle

# Zsh
git-untangle --generate-completions zsh > ~/.zfunc/_git-untangle

# Fish
git-untangle --generate-completions fish > ~/.config/fish/completions/git-untangle.fish

# Manpages
git-untangle --generate-manpage > /usr/local/share/man/man1/git-untangle.1
git-chat --generate-manpage > /usr/local/share/man/man1/git-chat.1
git-mcs --generate-manpage > /usr/local/share/man/man1/git-mcs.1
git-review --generate-manpage > /usr/local/share/man/man1/git-review.1
git-scope --generate-manpage > /usr/local/share/man/man1/git-scope.1

Quick Start

# Pure deterministic decomposition (no network / no API keys)
git untangle HEAD --no-llm

# Decompose a diverged branch range restricted to src/
git untangle main...HEAD --no-llm -- src/

# Explode each commit in a range individually in chronological order (without squashing)
# and install `git replace` references (`refs/replace/<oid>`) for each commit
git untangle main..HEAD --per-commit --replace --no-llm

# Install `git replace` references (`refs/replace/<oid>`) for an untangled commit
git untangle HEAD --no-llm --replace

# Verify every intermediate operation builds and auto-repair dependency order
git untangle HEAD --no-llm --verify "cargo check --quiet"

# Refine clusters, dependencies, and write commit messages with an LLM
export ANTHROPIC_API_KEY="sk-ant-..."
git untangle HEAD --model anthropic::claude-sonnet-4-5 --verify "cargo check --quiet"

# General interactive Git chat backed by an MCP Git-command dispatch server (`git_run`)
git chat --model anthropic::claude-sonnet-4-5

# Interactive chat about revision history backed by an MCP tool server (including Git notes)
git chat --model anthropic::claude-sonnet-4-5 log
git chat --model anthropic::claude-sonnet-4-5 --prompt "When was auth added?" log

# Interactive chat about a diff backed by a scoped MCP diff tool server (with volume-limited overview & Git notes)
git chat --model anthropic::claude-sonnet-4-5 diff main..HEAD -- src/
git chat --model anthropic::claude-sonnet-4-5 diff --cached

# Interactive MCP-driven merge conflict resolution
git chat --model anthropic::claude-sonnet-4-5 mergetool

# Autogenerate a commit message from staged changes and commit
git chat --model anthropic::claude-sonnet-4-5 commit
git chat --model anthropic::claude-sonnet-4-5 commit --dry-run

# Interactive chat about any other Git command (direct output captured up to 20 KiB by default)
git chat --model anthropic::claude-sonnet-4-5 status

# Configure default chat byte limit in Git config (or GIT_CHAT_MAX_BYTES)
git config untangle.model anthropic::claude-haiku-5-5
git config untangle.chatMaxBytes 20480

# Record and replay LLM responses deterministically for CI / offline testing
git untangle HEAD --model gemini::gemini-2.5-pro --record-llm cassette.jsonl
git untangle HEAD --replay-llm cassette.jsonl

# Derive, verify, inspect, and replay Minimum Change Scripts (stored in refs/notes/mcs)
git mcs HEAD --model anthropic::claude-sonnet-4-5 --allow-tool ast-grep
git mcs -n 5 --model anthropic::claude-sonnet-4-5          # last 5 commits
git mcs -n inf --model anthropic::claude-sonnet-4-5        # entire history (confirms if > 10 commits)
git mcs --all --model anthropic::claude-sonnet-4-5         # all commits across all branches
git mcs --verify -n 5                                      # list and validate MCS notes across last 5 commits
git mcs --prune --all                                      # remove invalid or non-compressing MCS notes across all branches
git mcs --split -n 5                                       # explode commits into mcs:body + mcs:residual via git replace
git mcs show HEAD --stats
git mcs verify HEAD
git mcs apply HEAD --body-only   # replay only the scripted refactor onto another branch
git mcs list
git push origin refs/notes/mcs   # share MCS notes with collaborators

# Manage named code review sessions stored in refs/notes/review/<name>.json
git review start security-audit
git review add -p src/config.ts --span 1:1-3:3 -m "Verify default theme fallback."
git review show HEAD
git review list --all
git review edit <comment-id> -m "Updated comment body."
git review rm <comment-id>
git review verify
git review end

# Launch the embedded GitScope visual Git UI for the current repository
git scope
git scope --port 7878 --no-open

# Run the Playwright E2E demo of `git scope` (exercises `git untangle`, `git mcs`, `git mcs split`, and `git review` on an isolated worktree and records `demo/report.md` with screenshots)
(cd gitscope && npm ci && npm run build:server)
cargo build --bins
npm --prefix e2e run test:e2e

Supported LLM Providers

Credentials are read strictly from environment variables (never .git/config or config.toml):

Provider Model Specifier Environment Variable Optional Base URL
Anthropic anthropic::claude-sonnet-4-5 ANTHROPIC_API_KEY ANTHROPIC_BASE_URL
Google Gemini gemini::gemini-2.5-pro GEMINI_API_KEY / GOOGLE_API_KEY GEMINI_BASE_URL
OpenAI openai::gpt-4.1 OPENAI_API_KEY OPENAI_BASE_URL
OpenRouter openrouter::anthropic/claude-sonnet-4 OPENROUTER_API_KEY OPENROUTER_BASE_URL
Ollama (local) ollama::qwen2.5-coder:32b (none) OLLAMA_HOST

Configuration Precedence

  1. CLI flags (--model, --verify, --similarity, --emit, ...)
  2. Repository .git/config (git config untangle.verifyCommand "cargo check")
  3. User global ~/.gitconfig (git config --global untangle.model gemini::gemini-2.5-pro)
  4. XDG tool config ($XDG_CONFIG_HOME/git-untangle/config.toml)
  5. Built-in defaults

Documentation

Guides

  • How git-untangle and git-mcs Work — A developer-friendly walkthrough of the commit decomposition and Minimum Change Script algorithms, why they work, and when to use each.

Command Reference

  • git-untangle — Decompose a commit or range into an ordered DAG of atomic operations.
  • git-chat — Interactive MCP-powered Git wrapper (log, diff, mergetool, commit, and suite dispatch).
  • git-mcs — Derive, verify, inspect, apply, and split Minimum Change Scripts (refs/notes/mcs).
  • git-review — Manage named code review sessions and span-anchored comments (refs/notes/review/*.json).
  • git-scope / GitScope — Local-first visual Git workspace (D3 commit DAG, Monaco diff/editor, branch comparison, and review sessions) embedded into git-scope via gitscope/dist-server or runnable standalone as a browser PWA.

Specifications & Standards

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages