Skip to main content

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

Project description

🚀 Smart Commit

English | Русский

Python Version License: MIT

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 .gitignore fixes.
  • 🔒 Branch Guard: Safeguards main, master, prod, and release branches 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)

  1. Config Loader: Parses settings and initializes the UI language (EN/RU).
  2. Branch Guard: Aborts the operation if you are attempting to push directly to a protected branch.
  3. Automatic Staging: Executes git add . to prepare your changes.
  4. Security Scan: Checks staged files for passwords, tokens, and unignored .env files. If a leak is detected, it offers to add them to .gitignore automatically.
  5. Pre-commit Validation: Sequentially runs your custom commands. Any non-zero exit code stops the process to keep your remote history clean.
  6. Transaction: Executes git commit and git push to the specified remote.

📄 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.4.tar.gz (93.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.4-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

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

Hashes for smart_commit_tool-3.0.4.tar.gz
Algorithm Hash digest
SHA256 03b3d9dd02fe3dad192c87bbd3f938949afbfa8f62940856192c3930177ec06e
MD5 326774cc6b2b7612371943c8c4dad013
BLAKE2b-256 e675fd5169baed5597ba196836203397fc256b4a92ebda03acbaeb1483fbb192

See more details on using hashes here.

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

Hashes for smart_commit_tool-3.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 105d13fed1b7c1f5450564003e38bb29ccb43da83c6ea644302aea5e89a50b43
MD5 2ba46fca32d865f3db4cbf688bfe94bc
BLAKE2b-256 75a83488f12d7f5734096d6648596cdcaba9b854e7bed784380f040aa6aa119d

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