How mr-arashnm/auto_git_push works
Project Type and Purpose
• This is a Python‑based automation tool/service that periodically scans local Git repositories and automatically pushes commits to remote (GitHub).
• It optionally provides a minimal web interface (serviced by app.py + static/templates) and sends notifications via Email and Telegram.
File Structure
• Top‑level artifacts
• app.py → Entrypoint (likely Flask or CLI/web server)
• install.py → Installation script
• requirements.txt → Dependencies list
• config/ → Configuration loader (settings, secure_settings)
• Core logic
• core/repo_scanner.py → Finds repos, checks for new commits
• core/git_handler.py → Performs Git push operations
• Notifications
• notifications/email_notifier.py
• notifications/telegram_bot.py
• notifications/notifier.py → Abstract notifier interface
• Auxiliary
• utils/logger.py → Logging framework
• utils/validator.py → Input validation
• utils/id_to_chatId.py→ Mapping IDs for Telegram
• UI/Web assets
• static/… (CSS, JS)
• templates/index.html
Extract Key Insights from the README
• Core features: scheduler, multi‑repo support, logging, Telegram & Email notifications.
• Configurable parameters: list of repos, push frequency, notifier preferences.
Main Components
a. Scheduler Service
• Reads schedule from config
• Triggers the Repo Scanner at defined intervals
b. Repo Scanner
• Iterates through configured local Git repos
• Determines if new commits exist
c. Git Handler
• Executes git push to remote (GitHub)
d. Logging Module
• Records each push attempt/result to filesystem or a log sink
e. Notification Manager
• Implements a Notifier interface
• Email Notifier → SMTP server
• Telegram Notifier → Telegram Bot API
f. Configuration Loader
• Reads config/settings.py and secure_settings.py
g. (Optional) Web/CLI Interface
• app.py exposing a UI or REST endpoints for status & manual triggers
h. External Services
• GitHub (Git remote)
• SMTP service
• Telegram Bot API
Relationships and Data Flows
• Scheduler → triggers → Repo Scanner
• Repo Scanner → calls → Git Handler
• Git Handler → writes → Logging Module
• Git Handler → on success/failure → Notification Manager
• Notification Manager → Email Notifier → SMTP
• Notification Manager → Telegram Notifier → Telegram API
• app.py UI ↔ Configuration Loader
• UI ↔ Scheduler (for manual triggers/status)
Architectural Patterns
• Modular, layered design (separate core, notifications, utils)
• Strategy pattern for notifiers (common interface in notifier.py)
• Single responsibility per module
• Config‑driven behavior