Metadata-Version: 2.4
Name: gitsmith
Version: 0.2.0
Summary: Intelligent CLI tool for automated GitHub repository synchronization - clone, sync, and manage all your repos from one command
Author: Vamsi
License-Expression: MIT
Project-URL: Homepage, https://github.com/vamsi-31/gitfordge
Project-URL: Repository, https://github.com/vamsi-31/gitfordge
Project-URL: Bug Tracker, https://github.com/vamsi-31/gitfordge/issues
Project-URL: Documentation, https://github.com/vamsi-31/gitfordge#readme
Project-URL: Changelog, https://github.com/vamsi-31/gitfordge/blob/main/project_status.md
Keywords: git,github,cli,sync,clone,repository,automation,devtools
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Version Control :: Git
Classifier: Topic :: Utilities
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typer>=0.9.0
Requires-Dist: rich>=13.0.0
Requires-Dist: InquirerPy>=0.3.4
Requires-Dist: requests>=2.28.0
Requires-Dist: keyring>=24.0.0
Requires-Dist: click>=8.0.0
Requires-Dist: shellingham>=1.3.0
Dynamic: license-file

# gitsmith

**Intelligent CLI Repository Synchronization Engine**

[![CI](https://github.com/vamsi-31/gitfordge/actions/workflows/ci.yml/badge.svg)](https://github.com/vamsi-31/gitfordge/actions/workflows/ci.yml)
[![PyPI](https://img.shields.io/pypi/v/gitsmith-cli)](https://pypi.org/project/gitsmith-cli/)
[![Python](https://img.shields.io/pypi/pyversions/gitsmith-cli)](https://pypi.org/project/gitsmith-cli/)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

---

gitsmith automates the painful process of setting up all your GitHub repositories on a new machine. It authenticates via your GitHub token (stored securely in your OS keyring), fetches all accessible repos, compares them against your local filesystem, and **only clones what's missing** -- performing idempotent delta synchronization.

## Features

| Feature | Description |
|---|---|
| **Secure Auth** | Token encrypted in OS keyring (Windows DPAPI / macOS Keychain / Linux Secret Service) |
| **Delta Sync** | Compares remote vs local -- only clones what's missing |
| **Always Dry-Run First** | See exactly what will happen before any action is taken |
| **Interactive Skip** | Deselect any repos you don't want via checkbox |
| **Interactive CLI** | Beautiful wizard with step indicators, progress bars, Rich panels |
| **Org Support** | Sync personal repos, organization repos, or both |
| **Concurrent Cloning** | Clone multiple repos in parallel with ThreadPoolExecutor |
| **Fault Tolerant** | One repo failure doesn't crash the whole run |
| **Token Fingerprinting** | SHA-256 fingerprints for token identification without exposure |

## Installation

### From PyPI (recommended)

```bash
pip install gitsmith
```



## Quick Start

### 1. Store Your Token (one time)

```bash
gitsmith auth login
```

Your token is encrypted and stored in your OS credential manager. It is **never** stored in plain text files.

### 2. Sync All Repos (interactive wizard)

```bash
gitsmith sync
```

The wizard guides you through:
1. Authentication verification
2. Target selection (personal / org / both)
3. Directory and protocol configuration
4. **Dry-run preview** -- see all repos and their status
5. **Interactive skip** -- deselect repos you don't want
6. Confirmation -- approve before execution
7. Concurrent cloning with progress bars

### 3. Check Status (dry run only)

```bash
gitsmith status
```

### 4. Declarative Mode (for scripts/CI)

```bash
gitsmith sync --token $GITHUB_TOKEN --dir ./repos --no-interactive --yes
```

## Commands

| Command | Description |
|---|---|
| `gitsmith sync` | Main sync command (interactive wizard) |
| `gitsmith status` | Show delta without executing |
| `gitsmith auth login` | Store GitHub token securely |
| `gitsmith auth logout` | Remove stored token |
| `gitsmith auth status` | Show auth status + token fingerprint |

## Sync Flags

| Flag | Description |
|---|---|
| `--token`, `-t` | GitHub token (or use keyring) |
| `--org`, `-o` | Target specific organization |
| `--dir`, `-d` | Target directory (default: current) |
| `--protocol`, `-p` | Clone via `https` or `ssh` |
| `--include` | Only repos matching regex |
| `--exclude` | Skip repos matching regex |
| `--update` / `--no-update` | Pull existing repos |
| `--workers`, `-w` | Parallel clone threads (default: 4) |
| `--dry-run` | Preview only, don't execute |
| `--no-interactive` | Skip wizard |
| `--yes`, `-y` | Auto-confirm after preview |
| `--verbose`, `-v` | Show git output |

## Token Security

gitsmith takes token security seriously:

- **Never stored in files** -- uses OS-level encrypted credential managers
- **Never logged** -- token values are masked in all output
- **Fingerprinted** -- SHA-256 hash truncated to 8 chars for safe identification
- **Constant-time comparison** -- prevents timing attacks
- **Priority chain** -- CLI flag > env var > OS Keyring > interactive prompt

| Platform | Backend | Encryption |
|---|---|---|
| Windows | Credential Manager | DPAPI (user session key) |
| macOS | Keychain Access | AES-256 |
| Linux | Secret Service (GNOME Keyring / KDE KWallet) | Session-bound |

## License

MIT - see [LICENSE](LICENSE)
