Skip to main content

A local AI-assisted tool for maintaining long-lived forks.

Project description

Forklift

Forklift is a local CLI/TUI for keeping long-lived forks current. It finds the fork's current upstream base, chooses the next upstream target, rebases your custom commits, runs your local checks, and writes a report with the exact files, commits, checks, and branch changes.

detect-upstream-base -> target discovery -> rebase-assistant -> local-test-runner

Install

uv tool install forklift-ai

or:

pipx install forklift-ai

The primary command is:

forklift

auto-rebase is kept as a compatibility alias.

Quick Start

Run these inside your forked repository:

forklift init
forklift doctor
forklift detect-base
forklift run

forklift init writes .auto-rebase.yaml and opens a guided setup form when the terminal is interactive. The form auto-loads local remotes, remote-tracking branches, tags, tag patterns, and likely test commands.

For later edits:

forklift config edit

What forklift run Does

1. refuse to start if the working tree has unrelated local changes
2. detect the fork's current upstream base
3. resolve the target upstream tag or branch
4. run baseline checks before rebasing
5. create a local backup branch
6. rebase your custom commits onto the target
7. run post-rebase checks
8. apply the successful rebase back to your original branch
9. show a run screen with the result and push decision
10. write artifacts and a final summary

If use_worktree: true is enabled, Forklift does the risky work in a temporary worktree first. When the post-rebase checks pass, it moves your original branch to the successful rebased HEAD and removes the temporary run branch.

The CLI prints the important result directly:

Forklift run complete
- status: healthy
- branch: test_branch
- base: v1
- target: v2
- custom commits replayed: 4
- changed files: 7
- local branch updated: yes
- backup branch: auto-rebase/backup-...

Checks
- baseline/tests: passed (0)
- post_rebase/tests: passed (0)

Next step
- remote branch updated: no
- push rebased branch: git push --force-with-lease origin test_branch

status=healthy
report=.auto-rebase/artifacts/.../summary.md

In an interactive terminal, forklift run opens a TUI that shows the local result and asks whether to push the rewritten branch. Forklift never pushes silently. A successful rebase rewrites local commit IDs, so remote updates require an explicit confirmation and use --force-with-lease.

For scripts or raw terminal output:

forklift run --plain

Configuration

The generated .auto-rebase.yaml is intentionally small enough to review:

project:
  name: forklift

auto_rebase:
  target_mode: latest_tag
  explicit_target: null
  max_iterations: 5

detect_upstream_base:
  upstream_remote: upstream
  upstream_branch: main
  tag_pattern: "v*"

local_test_runner:
  baseline_required: true
  checks:
    - name: tests
      run: "uv run --extra dev pytest -q"
      timeout_minutes: 20

forklift init overwrites an existing .auto-rebase.yaml with a clean generated file. Use forklift config edit when you want to update it later.

Artifacts

Every run writes a timestamped folder under .auto-rebase/artifacts/:

detection/      current base, base tag, custom commits, patch
target/         selected target ref and upstream diff
measurement/    baseline and post-rebase command logs
controller/     rebase logs, conflicts, repair packets, apply logs
summary.md      branch update, commits, conflicts, files, check results
replay.sh       manual reproduction script

The newest run is also linked at .auto-rebase/artifacts/latest/.

Safety

Forklift is local-first and conservative:

  • refuses dirty working trees by default
  • creates a backup branch before rebasing
  • never pushes without explicit confirmation
  • only updates the original branch after post-rebase checks pass
  • keeps failed/conflicted worktrees available for inspection
  • redacts common secret variables from logs and repair packets

Development

uv run --extra dev pytest
uv run --extra dev ruff check .
uv build --no-sources

Verify a built wheel through the tool-install path:

UV_TOOL_DIR=/tmp/forklift-tool \
UV_TOOL_BIN_DIR=/tmp/forklift-tool-bin \
uv tool install dist/forklift_ai-0.1.0-py3-none-any.whl

/tmp/forklift-tool-bin/forklift init

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

forklift_ai-0.1.0.tar.gz (53.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

forklift_ai-0.1.0-py3-none-any.whl (39.8 kB view details)

Uploaded Python 3

File details

Details for the file forklift_ai-0.1.0.tar.gz.

File metadata

  • Download URL: forklift_ai-0.1.0.tar.gz
  • Upload date:
  • Size: 53.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for forklift_ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1f09bffd664f13b7e8e3e81b32067c7ea3e69a7fa8175ebfe3fed2247621d7e4
MD5 8fc5f540b6602d9e74ca52eba72f1310
BLAKE2b-256 95367543cd68515e134858ee654c6a9155dafabb6c0741eed04ab34b583d5478

See more details on using hashes here.

File details

Details for the file forklift_ai-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: forklift_ai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 39.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for forklift_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6391274f88ae421c0ce2f6d05b17e5a4d44ede2fac733e31237df53fff2ddbf2
MD5 8526c19141d28507f3ca1a25dfb0da3b
BLAKE2b-256 88eb477edc2548a47dfc48e205a6b80acc83593df710790752339682e78d9288

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page