Metadata-Version: 2.4
Name: zyt-si
Version: 2.1.1
Summary: Git-based package manager CLI
Author: Samail Islam
License: GNU General Public License v3
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# zyt 🚀

**zyt** is a lightweight, high-performance Git repository manager designed to streamline your terminal-based workflow. It automates common tasks like cloning, forking, and syncing, allowing you to focus on code rather than Git syntax.

---

## 📖 Overview

Working with Git often involves repetitive commands, manual remote configurations, and context-switching between different authentication methods. **zyt** eliminates these friction points by providing:

- **Intuitive Commands:** Short, memorable aliases for complex Git operations.
- **Auto-Authentication:** Seamlessly detects and uses Git CLIs (`gh`, `glab`), SSH, or HTTPS.
- **Smart Forking:** Automatically configures `origin` (your fork) and `upstream` (the source) remotes.
- **Selective Cloning:** Clone specific files or directories without downloading the entire repository.
- **Local Registry:** Keeps track of your managed repositories with metadata like clone date and auth method.

---

## 🚀 Getting Started

### Installation
The recommended way to install **zyt** is via `pipx`:

```bash
pipx install zyt-si
```

### Requirements
- Python >= 3.8
- `git`
- (Optional) GitHub CLI (`gh`) or GitLab CLI (`glab`) for enhanced forking support.

---

## 🛠 Core Commands

| Command | Description | Flag Support (`-my`) | Usage Example |
| :--- | :--- | :---: | :--- |
| `in` | Clone a repository | ✅ | `zyt in google/googletest` |
| `f` | Fork and clone | ✅ | `zyt f torvalds/linux` |
| `sync` | Sync fork with upstream | ❌ | `zyt sync linux` |
| `up` | Fresh re-clone | ✅ | `zyt up owner/repo` |
| `get` | Clone specific directory/file | ✅ | `zyt get owner/repo/src` |
| `un` | Delete local repository | ❌ | `zyt un my-old-repo` |
| `l` | List managed repositories | ❌ | `zyt l a` |
| `info` | View repository details | ❌ | `zyt info my-repo` |
| `man` | Detailed manual | ❌ | `zyt man sync` |

---

## 🔥 Features & Deep Dive

### 🔐 Authentication Auto-Detection
**zyt** intelligently identifies the best way to interact with your Git provider. It prioritizes methods in this order:
1.  **Git CLIs:** Uses existing authentication from `gh`, `glab`, or `bitbucket`.
2.  **SSH:** Uses your local SSH keys.
3.  **HTTPS:** Falls back to standard HTTPS cloning.

### 🍴 Professional Forking & Syncing
- **Fork (`f`):** Forks the repo via CLI, clones it, and automatically adds the source as an `upstream` remote.
- **Sync (`sync`):** Fetches from `upstream`, detects your current branch, and attempts a **rebase**. If conflicts occur, it safely aborts the rebase and performs a **merge** instead.

### 📥 Selective Clone (`get`)
Download only specific parts of a repository. It offers two modes:
1.  **Absolute Path:** If you know the exact path (e.g., `src/utils`), **zyt** will extract it directly.
2.  **Search Mode:** If you only know the filename or folder name, **zyt** will scan the repo, list all matches, and let you pick the one you want to download.

### 🔄 Safe Updates (`up`)
Unlike a simple `git pull`, `zyt up` ensures a clean state:
1.  It renames your current directory to a timestamped `trash` folder.
2.  It performs a fresh `git clone`.
3.  On success, it deletes the `trash`. On failure, it **rolls back** by restoring your original folder.

### 👤 The `-my` Flag
Available for `in`, `f`, `up`, and `get`. It automatically prepends your Git `user.name` to the repository path.
```bash
zyt in my-project -my
# Result: zyt clones <your-username>/my-project
```

---

## 📂 Project Structure

```text
src/zyt/
├── auth.py         # Authentication detection logic
├── cli.py          # CLI entry point and dispatching
├── config.py       # Configuration and data path management
├── gitops.py       # Core Git operations (clone, fork, sync)
├── registry.py     # Local JSON registry management
├── OtherOps.py     # Manuals and auxiliary operations
└── ExceptionHandler.py # Centralized error handling
```

---

## 📄 License

**zyt** is open-source software licensed under the [GNU General Public License v3](LICENSE).
