This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
ACP (Automatic Commit Pusher) is a Python CLI tool that creates GitHub pull requests from staged changes in a single command. It handles branch creation, committing, pushing, and PR creation automatically.
Requirements: Python 3.9+, Git CLI, GitHub CLI (gh)
# Setup dev environment (creates venv and installs dependencies)
make setup
# Run tests
make test
# Run single test
venv/bin/pytest test_acp.py::TestClassName::test_method_name -v
# Run with coverage
venv/bin/pytest test_acp.py --cov=acp --cov-report=term-missing
# Linting
make lint
# Format code
make format
# Clean test artifacts
make cleanThe codebase is a single-file CLI tool (acp.py) with tests (test_acp.py).
- Validate staged changes exist
- Generate temporary branch:
acp/{username}/{random-16-digits} - Checkout temp branch, commit (interactive for git hooks), push
- Switch back to original branch, restore any unstaged changes
- Create PR via
gh pr create - Optionally merge and cleanup branches
run()/run_check()/run_interactive()- Command executionparse_github_url()- Extract owner/repo from git remote URLsget_repo_info()- Detect fork status and determine upstream/origincreate_github_pr()- PR creation via GitHub CLImerge_pr()/enable_auto_merge()- Post-creation merge handlingcleanup_branches_after_merge()- Remove temporary branches after merge
The tool automatically detects fork vs non-fork repos and adjusts PR target.
All workflows in .github/workflows/:
- tests.yaml - pytest across Python 3.9-3.13
- code-lint.yaml - Ruff linting
- code-format.yaml - Black formatting check
Use python tools/release.py <version> to:
- Update version in pyproject.toml, acp.py, README.md
- Create release commit and tag
- Trigger GitHub Actions release workflow