Metadata-Version: 2.4
Name: auto-github-committer
Version: 0.1.0
Summary: Automatic git commit + push with CLI and desktop GUI.
Author: Dhruv
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# Automated CLI GitHub Committer

This project provides both a CLI and a desktop GUI that watch a folder and automatically commit + push to GitHub whenever there are git changes.

## Prerequisites
- Git installed and on PATH
- Python 3.9+
- GitHub authentication configured (HTTPS + PAT or Git Credential Manager)

## CLI Usage
### Setup
```bash
python autocommit.py setup --remote https://github.com/<user>/<repo>.git
```
Initializes a git repo if needed, sets the remote and branch, creates an initial commit (if files exist or `--allow-empty-initial` is used), pushes to GitHub, and writes `.autocommit.json`.

### Run (continuous)
```bash
python autocommit.py run
```
Checks for file changes every `interval` seconds and automatically commits and pushes when changes are detected.

### Run once
```bash
python autocommit.py run --once
```
Runs a single check/commit cycle and exits.

### Commit once
```bash
python autocommit.py commit
```
Performs a single commit + push cycle without starting the watcher.

### Use a specific folder
```bash
python autocommit.py --path "C:\path\to\repo" run
```
By default, the CLI uses the current directory.

### CLI Config
The `.autocommit.json` file lives in the repo folder and is shared by both CLI and GUI.
- `remote`: GitHub repo URL
- `branch`: branch to push to (default `main`)
- `interval`: seconds between checks
- `message_prefix`: prefix for auto commit messages

Override run-time settings with `--interval` or `--message`.
Auto-commit messages include the timestamp and a short change summary, for example:
`Auto commit 2026-06-01 10:12:00+0530 | M app.py (+3 -1); A README.md`

## Desktop App (Tkinter GUI)
```bash
python autocommit_gui.py
```
The GUI uses the same config file and actions as the CLI.

### How to use the GUI
1. Click **Browse** and select the folder to watch.
2. Fill in **Remote URL** (required) and adjust other fields if needed.
3. Click **Setup Repo** once to initialize and push.
4. Click **Start Watching** to auto-commit and push whenever changes appear.
5. Click **Stop** to pause watching.

### GUI Controls (every button and field)
| Control | What it does |
| --- | --- |
| Folder | The local folder to watch and commit from. |
| Browse | Opens a folder picker and loads `.autocommit.json` if it exists. |
| Remote URL | GitHub repository URL used for `origin`. |
| Branch | Branch name to push to (default `main`). |
| Interval (sec) | How often the app checks for changes. |
| Message prefix | Prefix used in auto-commit messages. |
| Git user.name | Optional repo-local git user name (auto-filled from git config when available). |
| Git user.email | Optional repo-local git user email (auto-filled from git config when available). |
| Allow empty initial commit | Lets setup create an empty first commit if the folder has no files. |
| Setup Repo | Initializes git, sets remote/branch/user, creates the first commit, pushes, and saves config. |
| Start Watching | Starts the background watcher that commits + pushes when changes are found. |
| Stop | Stops the watcher. |
| Status line | Shows the latest action or error from the app. |

## Single EXE (GUI + CLI)
Build a single Windows EXE that runs the GUI when double-clicked and the CLI when arguments are provided.

```bash
python -m pip install pyinstaller
pyinstaller --onefile autocommit_app.py --name AutoCommitter
```

Usage:
- GUI: double-click `dist\AutoCommitter.exe`
- CLI: run from a terminal, for example  
  `dist\AutoCommitter.exe setup --remote https://github.com/<user>/<repo>.git`

## PyPI Package
Once published, install with:
```bash
pip install auto-github-committer
```
Commands:
- `autocommitter` (GUI if no args, CLI if args are provided)
- `autocommitter-cli` (CLI only)
- `autocommitter-gui` (GUI only)

### Publish to PyPI
1. Build the package:
```bash
python -m pip install build twine
python -m build
```
2. Upload with your PyPI token set in your environment:
```bash
setx TWINE_USERNAME __token__
setx TWINE_PASSWORD <your-pypi-token>
python -m twine upload dist\*
```
