Metadata-Version: 2.4
Name: gemcli
Version: 2.0.4
Summary: GemCLI: Autonomous AI coding agent with local web UI, Telegram remote control, and unlimited Gemini access — all from your terminal
Author: 89P13
License: MIT
Project-URL: Homepage, https://pypi.org/project/gemcli/
Keywords: gemini,ai,cli,terminal,coding-assistant,automation,autonomous-agent,web-ui,telegram-bot,code-generation,system-commands,image-generation,git-integration
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: Software Development :: Code Generators
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
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: Operating System :: OS Independent
Classifier: Environment :: Console
Classifier: Environment :: Web Environment
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: gemini-webapi>=2.0.0
Requires-Dist: rich>=13.0.0
Requires-Dist: questionary>=2.0.0
Requires-Dist: prompt-toolkit>=3.0.0
Requires-Dist: requests>=2.28.0
Requires-Dist: websocket-client>=1.6.0
Requires-Dist: pywin32>=306; sys_platform == "win32"
Requires-Dist: pycryptodome>=3.20.0
Requires-Dist: selenium>=4.15.0
Provides-Extra: telegram
Requires-Dist: python-telegram-bot>=20.0; extra == "telegram"
Provides-Extra: cookies
Requires-Dist: browser_cookie3>=0.19.0; extra == "cookies"
Provides-Extra: all
Requires-Dist: python-telegram-bot>=20.0; extra == "all"
Requires-Dist: browser_cookie3>=0.19.0; extra == "all"
Requires-Dist: playwright>=1.40.0; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: black>=23.0; extra == "dev"
Requires-Dist: browser_cookie3>=0.19.0; extra == "dev"
Dynamic: license-file

<p align="center">
  <img src="gemcli/web_assets/gemcli_mod.png" alt="GemCLI" width="160" />
</p>

<h1 align="center">GemCLI</h1>

<p align="center">
  <strong>Autonomous AI agent for your terminal. Free. No API keys. No subscriptions.</strong>
</p>

<p align="center">
  <a href="https://pypi.org/project/gemcli/"><img src="https://img.shields.io/pypi/v/gemcli?style=flat-square&color=4f8ff7" alt="PyPI" /></a>
  <a href="https://python.org"><img src="https://img.shields.io/badge/python-3.8%2B-3776ab?style=flat-square&logo=python&logoColor=white" alt="Python" /></a>
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="License" /></a>
  <a href="https://github.com/Textualize/rich"><img src="https://img.shields.io/badge/built%20with-Rich-purple?style=flat-square" alt="Built with Rich" /></a>
</p>

<p align="center">
  GemCLI is an open-source, autonomous AI agent that runs entirely from your terminal.<br/>
  It writes code, automates your system, controls your browser, manages desktop applications,<br/>
  generates images, and handles git workflows — all powered by Google Gemini with zero cost.
</p>

---

## What Can It Do?

```
You:  "Build me a Flask API with user authentication and deploy it locally"
You:  "Open YouTube and search for lofi music"
You:  "Find all Python files in this project that import requests and refactor them"
You:  "Go to my Gmail and read the latest email"
You:  "Switch VS Code to dark theme"
You:  "Create a React component for a pricing table with three tiers"
You:  "Commit everything with a good message and push to main"
```

GemCLI handles all of these autonomously. It reads your codebase, runs shell commands, navigates websites in a real browser, controls desktop applications, and reports back when done. No copy-pasting. No manual steps.

---

## Why GemCLI

| | |
|:--|:--|
| **Completely free** | Uses Google Gemini's web interface. No API keys, no tokens, no billing. |
| **2-minute setup** | `pip install gemcli` and you're running. |
| **Actually autonomous** | Doesn't just suggest code. It creates files, runs commands, opens browsers, and iterates until the task is done. |
| **Browser automation** | Opens a real Chromium browser, reads pages, clicks buttons, fills forms, manages tabs. |
| **Desktop automation** | Controls native Windows applications — focus windows, click UI elements, type text, change settings. |
| **Code generation** | Writes, reads, edits, and refactors code across your entire project. |
| **System control** | Runs shell commands, manages files, launches applications. |
| **Web interface** | Bundled local dashboard on `localhost` with session management, analytics, and dark/light themes. |
| **Telegram remote** | Send commands from your phone and receive live output. |
| **Git integration** | Auto-commit with AI-generated messages, push, branch management. |
| **Undo everything** | Every file change is backed up. Run `/undo` to revert instantly. |
| **100% local** | No remote server. Your data and credentials never leave your machine. |

---

## Installation

```bash
pip install gemcli[all]
```

That's it. Run `gemcli` to start.

For browser automation, also run:

```bash
playwright install chromium
```

### Requirements

- Python 3.8 or higher
- A Google account signed into [gemini.google.com](https://gemini.google.com)
- Git (optional, for `/commit`, `/push`, `/status`)

---

## Quick Start

```bash
gemcli
```

1. Select **Connect to Gemini** from the main menu
2. Authenticate -- paste cookies manually, or use auto-capture (Selenium grabs them from your browser automatically)
3. Pick a session -- start a new chat or continue a previous one
4. Start building -- ask GemCLI to do anything

### Authentication

GemCLI authenticates through browser cookies. No API key required. Your cookies are stored locally in `.gemini_cookies.json` and never leave your machine.

**Auto-Capture (recommended):** Run `gemcli`, connect to Gemini, and select "Auto-capture from browser." A browser window opens, you log in, and cookies are captured automatically.

**Manual:** Visit [gemini.google.com](https://gemini.google.com), open DevTools (F12), go to Application > Cookies > `https://gemini.google.com`, and copy `__Secure-1PSID` (required) and `__Secure-1PSIDTS` (recommended). Paste into GemCLI when prompted.

---

## Features

### Autonomous Agent

Every message goes through a unified intelligent agent that decides what to do and executes it autonomously:

1. **Understand** -- reads your prompt and plans the approach
2. **Act** -- runs commands, creates files, navigates browsers, controls desktop apps
3. **Iterate** -- loops through actions until the task is complete (up to 50 steps)
4. **Report** -- gives you a clean summary of what it did

All file changes are backed up automatically. Run `/undo` at any time to revert.

### Code Automation

GemCLI reads your entire project context and generates, edits, or refactors code with full awareness of your codebase.

```
"Add error handling to all the API endpoints in server.py"
"Create unit tests for the User model"
"Refactor this function to use async/await"
```

The agent creates files, modifies existing code, and runs your test suite to verify changes.

### Browser Automation

GemCLI launches a visible Chromium browser and controls it like a human user -- clicking, typing, scrolling, and navigating across pages and tabs.

```
"Open YouTube and search for lofi music"
"Go to my Gmail and read the first email"
"Navigate to this Google Form and fill it out"
"Open Amazon and add wireless earbuds to my cart"
"Go to GitHub and create a new repository called test-project"
```

**How it works:** The AI reads the actual DOM of every page, identifies interactive elements (buttons, inputs, links), decides what to click or type, executes the action, then re-reads the page and decides the next step. Persistent login sessions mean you log in once and stay logged in.

```bash
# Setup
pip install playwright
playwright install chromium
```

### Desktop Application Automation

GemCLI can control native Windows desktop applications -- focus windows, interact with UI elements, type into command palettes, and change application settings.

```
"Switch VS Code to the One Dark Pro theme"
"Open Notepad and type a quick note"
"Focus the calculator app and perform a calculation"
```

### System Automation

Run any shell command, manage files, launch applications, and automate system tasks.

```
"List all large files over 100MB in this directory"
"Set up a Python virtual environment and install Flask"
"Find and kill the process running on port 3000"
```

### Web Interface

A bundled browser-based dashboard served on `localhost`. No external dependencies -- pure HTML, CSS, and JavaScript.

- Session sidebar -- browse, switch, and delete sessions
- Real-time sync -- messages from CLI sessions appear automatically
- Dark and light mode with saved preference
- Analytics dashboard -- token usage, request counts, backup stats
- Remote control tab for Telegram bridge monitoring
- Launch from the CLI menu or visit `http://127.0.0.1:8765`

### Telegram Remote Control

Control GemCLI from your phone via a Telegram bot.

1. Create a bot via [@BotFather](https://t.me/BotFather) on Telegram
2. Get your Chat ID from [@userinfobot](https://t.me/userinfobot)
3. In GemCLI: main menu > Settings > Telegram Remote Control
4. Enter your bot token and chat ID

Send text messages to the bot and they execute as GemCLI prompts. Receive real-time output on your phone.

### Git Integration

Built-in git workflows with AI-generated commit messages.

```
/status      View repository status
/commit      Commit with an AI-generated message
/push        Push to the remote repository
```

### Undo System

Every file modification is backed up before changes are applied.

```
/undo        Revert the last change-set
/undo 3      Revert the last 3 change-sets
/history     View all recorded change-sets
```

Backups are stored in `.gemcli/backups/` with timestamped directories.

---

## Commands

All commands work inside any session:

| Command | Description |
|:--------|:------------|
| `/help` | Show all available commands |
| `/exit` | End the session and return to session list |
| `/clear` | Clear the terminal screen |
| `/undo [N]` | Revert the last N file change-sets (default: 1) |
| `/history` | View file modification timeline |
| `/recall <keyword>` | Search past conversations by keyword |
| `/export` | Export the current session to a Markdown file |
| `/summary` | Generate an AI-powered session recap |
| `/analytics` | Show token usage, request counts, and backup stats |
| `/status` | Display git repository status |
| `/commit` | Create a commit with an AI-generated message |
| `/push` | Push commits to the remote repository |
| `/view <path>` | Read and display a file with syntax highlighting |
| `/image <prompt>` | Generate an AI image from a text description |

---

## Architecture

```
gemcli/
  cli.py            Entry point, session selection, authentication flow
  agent.py          Unified chat loop — handles all user interactions
  autobot.py        Autonomous JSON action executor
  backup.py         File backup and undo system
  browser.py        Autonomous browser agent — Playwright-based web control
  desktop.py        Desktop application automation — native UI control
  client.py         Gemini client initialization
  config.py         Centralized theme, preferences, and console
  context.py        Workspace context builder for AI prompts
  cookies.py        Cookie management — manual, saved, and auto-capture
  git_ops.py        Git integration — status, commit, push, branch selection
  history.py        Session history — logging, listing, search, export
  mark_page.js      DOM element annotator for browser agent
  remote_monitor.py Telegram bridge monitor loop
  settings.py       Interactive settings menu
  ui.py             Rich-based terminal UI — banner, spinner, animated status
  web.py            Local HTTP server — REST API + static file serving
  workspace.py      File search and workspace scanning utilities
  web_assets/
    index.html      Single-page web interface
    styles.css      Full design system — dark/light themes
    app.js          Client-side logic — sessions, chat, analytics
```

---

## Configuration

Access from the main menu under Settings:

| Setting | Description |
|:--------|:------------|
| Theme | Cyan, Pink, Gold, Green, Purple, or White color schemes |
| Git | Toggle git integration, commit timing, auto-push, branch selection |
| Image | Set the save directory for AI-generated images |
| Telegram | Bot token, chat ID, workspace path, enable/disable bridge |

Settings are stored in `.gemcli/settings.json`.

---

## Privacy and Security

| Question | Answer |
|:---------|:-------|
| Where are cookies stored? | Locally in `.gemini_cookies.json` in your working directory |
| Do cookies leave my machine? | No. Sent only to Google's Gemini servers |
| Is there a remote server? | No. 100% client-side |
| Should I share my cookies? | Never. Treat them like passwords |

---

## Upgrading

```bash
pip install --upgrade gemcli
```

If upgrading from v1.x: the multi-mode selection (Chat / System Agent / AutoBot / Image Gen) has been replaced by a single unified agent that handles everything. Your existing `.gemcli/` history directory is fully compatible.

---

## Uninstall

```bash
pip uninstall gemcli
```

To also remove local data:

```bash
rm -rf .gemcli/
rm -f .gemini_cookies.json
```

---

## License

MIT License -- see [LICENSE](LICENSE) for details.

---

## Links

- PyPI: [pypi.org/project/gemcli](https://pypi.org/project/gemcli/)
- GitHub: [github.com/Aniketh78/Gemini-Terminal-Tool-GEM-CLI](https://github.com/Aniketh78/Gemini-Terminal-Tool-GEM-CLI)

---

<p align="center">Built by <a href="https://github.com/Aniketh78">89P13</a></p>
