Automated pre-push workflow manager with built-in code quality enforcement and smart branch protection.
Project description
🚀 Smart Commit
Smart Commit is a robust CLI tool designed to automate and secure your Git workflow. It orchestrates linting, security audits, committing, and pushing into a single, bulletproof operation.
The Golden Rule: If your linter fails or secrets are detected, your code doesn't ship.
✨ Key Features
- 🌍 Multi-language Support: Native logs in English and Russian (configurable via
pyproject.toml). - 🛡️ Security Shield: Automatically scans staged files for API keys, tokens, and secrets. Offers one-click
.gitignorefixes. - 🔒 Branch Guard: Safeguards
main,master,prod, andreleasebranches from accidental direct pushes. - ⚡ Interactive Flow: If flags are missing, the tool intelligently prompts you for the branch, message, and remote.
- 🔧 Zero-Setup: Works with any stack (Python, JS, Go, Rust, etc.) and is configured via a single standard file.
📦 Installation
pip install smart-commit-tool
🔧 Configuration (pyproject.toml)
Smart Commit leverages the standard pyproject.toml file. Create this section in your project root:
[tool.smart_commit]
language = "en" # Supports "en" and "ru"
repository_url = "https://github.com/user/repo.git" # SSH or HTTPS
protected_branches = ["main", "master", "prod"]
# Shell commands to run successfully BEFORE the push.
commands = [
"ruff check .", # Python Linter
"npm run lint", # Node.js Linter
"pytest" # Testing
]
🚀 Usage
Simply run the command in your project root:
smart-commit
CLI Arguments
If you prefer to bypass the interactive prompts, use these flags:
| Flag | Description |
|---|---|
-b, --branch |
Target branch name (creates the branch if it doesn't exist) |
-m, --message |
Commit message |
-r, --remote |
Remote repository name (defaults to origin) |
Example:
smart-commit -b feature/auth -m "feat: implement jwt logic" -r origin
🔄 How It Works (The Algorithm)
- Config Loader: Parses settings and initializes the UI language (EN/RU).
- Branch Guard: Aborts the operation if you are attempting to push directly to a protected branch.
- Automatic Staging: Executes
git add .to prepare your changes. - Security Scan: Checks staged files for passwords, tokens, and unignored
.envfiles. If a leak is detected, it offers to add them to.gitignoreautomatically. - Pre-commit Validation: Sequentially runs your custom
commands. Any non-zero exit code stops the process to keep your remote history clean. - Transaction: Executes
git commitandgit pushto the specified remote.
📄 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-3.0.4.tar.gz.
File metadata
- Download URL: smart_commit_tool-3.0.4.tar.gz
- Upload date:
- Size: 93.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.14.0 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03b3d9dd02fe3dad192c87bbd3f938949afbfa8f62940856192c3930177ec06e
|
|
| MD5 |
326774cc6b2b7612371943c8c4dad013
|
|
| BLAKE2b-256 |
e675fd5169baed5597ba196836203397fc256b4a92ebda03acbaeb1483fbb192
|
File details
Details for the file smart_commit_tool-3.0.4-py3-none-any.whl.
File metadata
- Download URL: smart_commit_tool-3.0.4-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.14.0 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
105d13fed1b7c1f5450564003e38bb29ccb43da83c6ea644302aea5e89a50b43
|
|
| MD5 |
2ba46fca32d865f3db4cbf688bfe94bc
|
|
| BLAKE2b-256 |
75a83488f12d7f5734096d6648596cdcaba9b854e7bed784380f040aa6aa119d
|