Metadata-Version: 2.4
Name: opencode-chat-exporter
Version: 1.0.0
Summary: Export OpenCode / AntiGravity local chats to a single connected Markdown file (GUI + CLI)
Author: nasro2123
License-Expression: MIT
Project-URL: Homepage, https://github.com/nasro2123/chat-exporter
Project-URL: Repository, https://github.com/nasro2123/chat-exporter
Project-URL: Issues, https://github.com/nasro2123/chat-exporter/issues
Keywords: opencode,antigravity,chat,export,markdown,cli
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3
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: Programming Language :: Python :: 3.14
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: customtkinter==5.2.2
Dynamic: license-file

# Chat Exporter

A Python tool that exports your local chats — from **OpenCode (Desktop)** or **AntiGravity (Google)** — into one **single connected Markdown file**, preserving every detail verbatim: user and assistant messages, CMD / PowerShell commands, tool outputs, file & search operations, and attachments.

## Features

- **Two chat sources**: OpenCode or AntiGravity (switch from the GUI or CLI)
- **Simple, clean GUI** (CustomTkinter) to browse and preview conversations
- **Live preview** with color-coded messages (you / assistant / tools)
- **Full export** of each conversation into one connected Markdown file — not separate sections
- Export all conversations to a folder, or everything into a single file
- **Live watch mode**: automatically re-export when the source updates
- Fully equivalent command-line interface

## Requirements

- Python 3.10+

## Building the EXE

**Easiest way:** double-click `build.bat`

Or from PowerShell:

```powershell
.\build.ps1            # onedir build (faster startup)
.\build.ps1 -OneFile   # single-file exe (easier to share)
```

The script handles everything automatically: creating a `.venv`, installing dependencies, then building with PyInstaller. Output goes to `dist\`.

## Usage

```
pip install -r requirements.txt

# GUI
python run.py

# CLI — OpenCode (default)
python -m chat_exporter --cli list
python -m chat_exporter --cli export --latest

# CLI — AntiGravity
python -m chat_exporter --cli --source antigravity list
python -m chat_exporter --cli --source antigravity export --latest
```

### Default locations

| Source | Path |
|---|---|
| OpenCode | `%USERPROFILE%\.local\share\opencode\opencode.db` |
| AntiGravity | `%USERPROFILE%\.gemini\antigravity` |

The path can be changed from the "…" button in the GUI or via `--db` (for AntiGravity, pass the `antigravity` folder containing `conversations\` and `brain\`).

### How does AntiGravity reading work?

Conversations are stored in a SQLite database with a `step_payload` column encoded as **protobuf**. The reader first tries the plain-text `transcript.jsonl` generated by the app under `brain\<uuid>\.system_generated\logs\` (easy and readable); if not found, it decodes the protobuf directly from the database. Both paths produce identical output.

## Project structure

```
Chat Exporter/
├── chat_exporter/
│   ├── db.py          # OpenCode database reader (sessions / messages / parts) + factory
│   ├── antigravity.py # AntiGravity reader (transcript.jsonl + protobuf fallback)
│   ├── render.py      # Conversation -> full Markdown renderer
│   ├── gui.py         # Graphical interface
│   ├── cli.py         # Command-line interface
│   └── __main__.py
├── run.py             # Launch the GUI
├── run_gui.py
├── build.bat          # One-click EXE build
├── build.ps1          # Build script (auto venv + PyInstaller)
└── requirements.txt
```

## Privacy

Everything runs locally — the tool reads data on your machine and writes Markdown files only. Nothing is sent to the internet. Review exported files before sharing them; they may contain sensitive paths and data from your sessions.
