Automated pre-push workflow manager with built-in code quality enforcement and smart branch protection.
Project description
🚀 Smart Commit
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 -> pushroutine. - 🛡️ Branch Protection: Safeguards your
main,master, orprodbranches from accidental direct pushes. - 🔧 Zero-Setup: Install via
pipand 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-commitcommand.
🔧 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)
- Environment Sanity Check: Verifies Git initialization and remote repository connectivity.
- Branch Guard: If you attempt to push to a protected branch, the tool prompts you to create a new feature branch instead.
- Pre-push Validation: Sequentially executes your defined
commands. If any step fails, the entire process stops immediately to keep your remote clean. - Optimized Push: Automatically handles
addandcommit. If the remote branch has moved forward, it helps yourebaseto ensure a linear, clean history.
📄 License
Distributed under the MIT License. Feel free to use, modify, and share!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smart_commit_tool-2.0.2.tar.gz.
File metadata
- Download URL: smart_commit_tool-2.0.2.tar.gz
- Upload date:
- Size: 225.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6082848d55212e8fa56f136a30eb72db42d9bbc60767a9ccd01035fd8542b7b1
|
|
| MD5 |
298a03be0b9103b7f714d1f4cc397276
|
|
| BLAKE2b-256 |
663ce1ab7cfa61af7328621013e6867eb6f8f300c5568715ff180f5ed2aa3171
|
File details
Details for the file smart_commit_tool-2.0.2-py3-none-any.whl.
File metadata
- Download URL: smart_commit_tool-2.0.2-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de48180b0f310e2b42ecc02bcc9659a62103c1e36faa30bf39669db54b8d1d9e
|
|
| MD5 |
0b7a18be358044e34bcbd12ab17f0837
|
|
| BLAKE2b-256 |
43254830df3fa4a97c81416d3ccc5d7cd9bb840e2afc721d95613498e5bb367a
|