Skip to main content

Automated pre-push workflow manager with built-in code quality enforcement and smart branch protection.

Project description

🚀 Smart Commit

English | Русский

PyPI version Python Version License: MIT GitHub stars

Smart Commit is a universal CLI tool designed to streamline and secure your Git workflow. It orchestrates linting, testing, committing, and pushing into a single, bulletproof operation.

The Golden Rule: If your tests fail, your code doesn't ship.


✨ Key Features

  • 🌍 Language Agnostic: Works seamlessly with Python, JS, Go, Rust, Dart, or any other stack.
  • All-in-One Command: Replaces the tedious lint -> test -> add -> commit -> push routine.
  • 🛡️ Branch Protection: Safeguards your main, master, or prod branches from accidental direct pushes.
  • 🔧 Zero-Setup: Install via pip and configure in under a minute using a single file.

📦 Installation

pip install smart-commit-tool

Note: Once installed, the tool is available via the simple and concise smart-commit command.


🔧 Configuration (pyproject.toml)

Smart Commit leverages pyproject.toml for its configuration. Simply create this file in your project root (even if you aren't using Python for your main project).

[tool.smart_commit]
repository_url = "https://github.com/youruser/yourrepo.git"
protected_branches = ["main", "master", "prod"]

# List any shell commands you want to run BEFORE the push.
# If any command returns a non-zero exit code, the process aborts.
commands = [
    "ruff check .",      # Python Linter
    "pytest -v",         # Python Tests
    "npm run lint",      # Node.js Linter
    "go test ./..."      # Go Tests
]

🚀 Usage

Navigate to your project root (where your pyproject.toml is located) and run:

smart-commit

CLI Arguments

Flag Description
-b, --branch Specify target branch (skips interactive prompt)
-m, --message Set commit message (skips interactive prompt)

🔄 How It Works (The Algorithm)

  1. Environment Sanity Check: Verifies Git initialization and remote repository connectivity.
  2. Branch Guard: If you attempt to push to a protected branch, the tool prompts you to create a new feature branch instead.
  3. Pre-push Validation: Sequentially executes your defined commands. If any step fails, the entire process stops immediately to keep your remote clean.
  4. Optimized Push: Automatically handles add and commit. If the remote branch has moved forward, it helps you rebase to ensure a linear, clean history.

Демонстрация smart-commit

📄 License

Distributed under the MIT License. Feel free to use, modify, and share!

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

smart_commit_tool-3.0.2.tar.gz (92.2 kB view details)

Uploaded Source

Built Distribution

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

smart_commit_tool-3.0.2-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file smart_commit_tool-3.0.2.tar.gz.

File metadata

  • Download URL: smart_commit_tool-3.0.2.tar.gz
  • Upload date:
  • Size: 92.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.14.0 Windows/11

File hashes

Hashes for smart_commit_tool-3.0.2.tar.gz
Algorithm Hash digest
SHA256 8794cb91c381bb7376ae55b3a7889149aea0d6647144b96e6b4275eba9fb17c7
MD5 d3079352263ae723575bd588ae75ec1b
BLAKE2b-256 a5db0e08a6ba16c2144f4af8203c5e521dae9f3e008de018e78b4cdcd27d3f55

See more details on using hashes here.

File details

Details for the file smart_commit_tool-3.0.2-py3-none-any.whl.

File metadata

  • Download URL: smart_commit_tool-3.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.14.0 Windows/11

File hashes

Hashes for smart_commit_tool-3.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 93d5bfa53a513ef281f4d04bba91963cd5b6ac91c28d37aee4324b774039b342
MD5 1fa4cef6bb3c17b3d7eae6f39c4c529f
BLAKE2b-256 972ba49016d8cbd768e631c615d8923be1743c7b67e2ce6c52b7c49faa9bb6c2

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