antigravity-export 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. antigravity_export-1.0.0/LICENSE +21 -0
  2. antigravity_export-1.0.0/PKG-INFO +324 -0
  3. antigravity_export-1.0.0/README.md +286 -0
  4. antigravity_export-1.0.0/pyproject.toml +68 -0
  5. antigravity_export-1.0.0/setup.cfg +4 -0
  6. antigravity_export-1.0.0/setup.py +8 -0
  7. antigravity_export-1.0.0/src/antigravity_export/__init__.py +24 -0
  8. antigravity_export-1.0.0/src/antigravity_export/__main__.py +8 -0
  9. antigravity_export-1.0.0/src/antigravity_export/api_client.py +134 -0
  10. antigravity_export-1.0.0/src/antigravity_export/cli.py +635 -0
  11. antigravity_export-1.0.0/src/antigravity_export/config.py +67 -0
  12. antigravity_export-1.0.0/src/antigravity_export/connection.py +279 -0
  13. antigravity_export-1.0.0/src/antigravity_export/exporters/__init__.py +16 -0
  14. antigravity_export-1.0.0/src/antigravity_export/exporters/file_changes_exporter.py +151 -0
  15. antigravity_export-1.0.0/src/antigravity_export/exporters/html_exporter.py +908 -0
  16. antigravity_export-1.0.0/src/antigravity_export/exporters/json_exporter.py +42 -0
  17. antigravity_export-1.0.0/src/antigravity_export/exporters/markdown_exporter.py +145 -0
  18. antigravity_export-1.0.0/src/antigravity_export/models.py +177 -0
  19. antigravity_export-1.0.0/src/antigravity_export/parser.py +402 -0
  20. antigravity_export-1.0.0/src/antigravity_export/recovery.py +185 -0
  21. antigravity_export-1.0.0/src/antigravity_export/storage.py +172 -0
  22. antigravity_export-1.0.0/src/antigravity_export.egg-info/PKG-INFO +324 -0
  23. antigravity_export-1.0.0/src/antigravity_export.egg-info/SOURCES.txt +29 -0
  24. antigravity_export-1.0.0/src/antigravity_export.egg-info/dependency_links.txt +1 -0
  25. antigravity_export-1.0.0/src/antigravity_export.egg-info/entry_points.txt +3 -0
  26. antigravity_export-1.0.0/src/antigravity_export.egg-info/requires.txt +10 -0
  27. antigravity_export-1.0.0/src/antigravity_export.egg-info/top_level.txt +1 -0
  28. antigravity_export-1.0.0/tests/test_exporters.py +92 -0
  29. antigravity_export-1.0.0/tests/test_models.py +33 -0
  30. antigravity_export-1.0.0/tests/test_parser.py +67 -0
  31. antigravity_export-1.0.0/tests/test_recovery.py +20 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Antigravity Export Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,324 @@
1
+ Metadata-Version: 2.4
2
+ Name: antigravity-export
3
+ Version: 1.0.0
4
+ Summary: Export and recover Google Antigravity conversations, diffs, and project histories via Language Server.
5
+ Author-email: Kayvan Jahanbakhsh <jahanbakhsh@live.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/your-username/antigravity-export
8
+ Project-URL: Repository, https://github.com/your-username/antigravity-export.git
9
+ Project-URL: Issues, https://github.com/your-username/antigravity-export/issues
10
+ Project-URL: Documentation, https://github.com/your-username/antigravity-export#readme
11
+ Keywords: antigravity,language-server,gemini,export,markdown,html,diff,git-patch,recovery
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Operating System :: OS Independent
22
+ Classifier: Environment :: Console
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Classifier: Topic :: Utilities
25
+ Requires-Python: >=3.9
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: requests>=2.31.0
29
+ Requires-Dist: urllib3>=2.0.0
30
+ Requires-Dist: rich>=13.0.0
31
+ Requires-Dist: typer>=0.9.0
32
+ Requires-Dist: jinja2>=3.1.0
33
+ Provides-Extra: dev
34
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
35
+ Requires-Dist: build>=1.0.0; extra == "dev"
36
+ Requires-Dist: twine>=5.0.0; extra == "dev"
37
+ Dynamic: license-file
38
+
39
+ # Antigravity Export (agexport)
40
+
41
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
42
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
43
+ [![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
44
+
45
+ A high-performance Python CLI and library to connect directly to the running **Google Antigravity Language Server** (`language_server`), inspect connection state, and export conversations, code modifications, unified git patches, and full reasoning chains into Markdown, self-contained HTML, and JSON. It also features a resilient **Crash Recovery Engine** that can restore unindexed or interrupted sessions directly from SQLite databases and brain logs.
46
+
47
+ [**🇮🇷 مستندات به زبان فارسی (Persian Documentation) در فایل README.fa.md موجود است.**](README.fa.md)
48
+
49
+ ---
50
+
51
+ ## ✨ Features
52
+
53
+ - 🛰️ **Language Server Connectivity**: Automatically discovers running Antigravity Language Server processes, dynamically scans listening ports, retrieves CSRF tokens, and connects over the gRPC-Web / HTTP Connect protocol.
54
+ - 📋 **Chat List & Project Navigation**: List and filter conversations by project, workspace, date, or step count with an interactive Rich terminal interface.
55
+ - 📁 **Multi-Project & Project-Scoped Export**: Export all conversations grouped neatly by project folders, or target a single project or conversation ID.
56
+ - 📝 **Markdown Export (`.md`)**: Clean GitHub-flavored Markdown with conversation metadata, user inputs, collapsible `<details>` tags for AI reasoning/thinking chains, and highlighted tool executions.
57
+ - 🌐 **Self-Contained HTML Export (`.html`)**: Beautiful, responsive, standalone single-page HTML files with modern dark-mode styling, syntax-highlighted unified diffs, collapsible thinking accordions, and zero external CDN dependencies (100% offline viewable).
58
+ - 📑 **Master Table of Contents (`index.html`)**: Automatically generates an interactive Table of Contents dashboard when exporting chats. Features instant search, project filtering pills, summary statistics (total conversations, projects, steps, lines modified), and direct quick-links to HTML, Markdown, JSON, and diff reports.
59
+ - 📊 **Structured JSON Export (`.json`)**: Complete, machine-readable JSON format for programmatic analysis, LLM evals, or database archiving.
60
+ - 🔍 **Dedicated File Changes & Git Patch Exporter**: Extracts all code edits, additions, deletions, unified diffs, and generates standard `.patch` files compatible with `git apply`.
61
+ - 🛡️ **Crash & Update Recovery Engine**: Recovers lost conversations after IDE crashes or updates by scanning `~/.gemini/antigravity/crashes/`, SQLite databases (`conversation_summaries.db`, `conversations/*.db`), and brain transcripts (`transcript_full.jsonl`).
62
+ - ⚡ **Global CLI & Python Library**: Can be installed globally as `agexport` / `antigravity-export` or imported into custom Python scripts.
63
+
64
+ ---
65
+
66
+ ## 🚀 Installation & Setup
67
+
68
+ ### Option 1: Using Virtual Environment (`venv`)
69
+
70
+ ```bash
71
+ # 1. Clone or navigate to the project directory
72
+ cd /path/to/antigravity-export
73
+
74
+ # 2. Create and activate a virtual environment
75
+ python -m venv venv
76
+
77
+ # On Windows (PowerShell):
78
+ .\venv\Scripts\Activate.ps1
79
+ # On macOS/Linux:
80
+ source venv/bin/activate
81
+
82
+ # 3. Install dependencies
83
+ pip install -r requirements.txt
84
+
85
+ # 4. Install the package in editable mode
86
+ pip install -e .
87
+ ```
88
+
89
+ ### Option 2: Global CLI Installation
90
+
91
+ To install globally so that `agexport` is available everywhere in your terminal:
92
+
93
+ ```bash
94
+ # Using standard pip
95
+ pip install .
96
+
97
+ # Or using pipx (recommended for isolated global CLI tools)
98
+ pipx install .
99
+ ```
100
+
101
+ ---
102
+
103
+ ## 💻 CLI Commands & Usage
104
+
105
+ Once installed, the CLI is available as either `agexport` or `antigravity-export`.
106
+
107
+ ### 1. Check Language Server Status
108
+ Verify whether the Antigravity Language Server is running, its PID, port, CSRF token, and storage overview:
109
+
110
+ ```bash
111
+ agexport status
112
+ # or
113
+ agexport info
114
+ ```
115
+
116
+ *Example Output:*
117
+ ```
118
+ Antigravity Language Server Status v1.0.0
119
+
120
+ ┌───────────────────────────┬─────────────────────────────────────────────────┐
121
+ │ Connection State │ CONNECTED │
122
+ │ Process State │ RUNNING │
123
+ │ Process ID (PID) │ 32808 │
124
+ │ Active Port │ 63316 │
125
+ │ CSRF Token │ f442deef-118... │
126
+ │ IDE Name / Version │ antigravity 2.26.0 │
127
+ │ App Data Directory │ C:\Users\user\.gemini\antigravity │
128
+ │ Stored Conversations (DB) │ 6 │
129
+ │ Crash Dumps Detected │ 4 │
130
+ └───────────────────────────┴─────────────────────────────────────────────────┘
131
+
132
+ [OK] Ready for export and real-time interaction (1 active endpoint(s))
133
+ ```
134
+
135
+ ---
136
+
137
+ ### 2. List Conversations
138
+ List active and stored conversations with metadata, project name, step count, and file change metrics:
139
+
140
+ ```bash
141
+ # List latest conversations
142
+ agexport list
143
+
144
+ # Filter conversations by project
145
+ agexport list --project adswinger-ai
146
+
147
+ # Show only today's conversations
148
+ agexport list --today
149
+
150
+ # Output as raw JSON (ideal for piping into jq)
151
+ agexport list --json
152
+ ```
153
+
154
+ ---
155
+
156
+ ### 3. List Projects & Workspaces
157
+ View an aggregated summary of all projects, workspaces, conversation counts, and total file modifications:
158
+
159
+ ```bash
160
+ agexport projects
161
+ ```
162
+
163
+ ---
164
+
165
+ ### 4. Export Conversations
166
+
167
+ Export conversations into Markdown, HTML, JSON, and extract file diffs:
168
+
169
+ ```bash
170
+ # Export all conversations across all projects (organized by project folder)
171
+ agexport export --all-projects -o ./my_exports
172
+
173
+ # Export all conversations for a specific project
174
+ agexport export -p adswinger-ai -o ./my_exports
175
+
176
+ # Export a single conversation by ID
177
+ agexport export --id c13776f9-5e3b-49e6-9532-3f19ab2a568a -o ./single_chat
178
+
179
+ # Export only in Markdown format
180
+ agexport export -f md -o ./markdown_only
181
+
182
+ # Export only in HTML format
183
+ agexport export -f html -o ./html_only
184
+
185
+ # Export only in JSON format
186
+ agexport export -f json -o ./json_only
187
+
188
+ # Exclude AI internal thinking process
189
+ agexport export --no-thinking -o ./concise_exports
190
+
191
+ # Offline export (reads directly from SQLite and brain logs without running server)
192
+ agexport export --all-projects --offline -o ./offline_exports
193
+ ```
194
+
195
+ ---
196
+
197
+ ### 5. Quick One-Shot Full Export
198
+ Shortcut command to export everything in all formats across all projects:
199
+
200
+ ```bash
201
+ agexport export-all -o ./antigravity_export
202
+ ```
203
+
204
+ ---
205
+
206
+ ### 6. Export File Changes & Git Patches
207
+ Specifically extract code modifications, unified diffs, and generate `.patch` files:
208
+
209
+ ```bash
210
+ # Export all file changes across all projects
211
+ agexport export-changes -o ./patches
212
+
213
+ # Export file changes for a specific project
214
+ agexport export-changes -p antigravity-export -o ./patches
215
+ ```
216
+
217
+ Generated files include:
218
+ - `<Title>_<ID>_file_changes.md`: Chronological summary of edits with unified diffs.
219
+ - `<Title>_<ID>.patch`: Standard Git patch file ready to apply via `git apply`.
220
+ - `<Project>_project_file_changes.md`: High-level overview of all modified files.
221
+
222
+ ---
223
+
224
+ ### 7. Recover Lost Conversations After Crashes/Updates
225
+ Scan local crash logs (`~/.gemini/antigravity/crashes/`), unindexed SQLite databases, and brain transcripts to restore lost sessions:
226
+
227
+ ```bash
228
+ # 1. Preview recoverable sessions without writing files (dry-run)
229
+ agexport recover --dry-run
230
+
231
+ # 2. Recover unindexed/lost conversations
232
+ agexport recover -o ./recovered_chats
233
+
234
+ # 3. Force full offline recovery of all sessions on disk
235
+ agexport recover --all --force-offline -o ./full_recovery
236
+ ```
237
+
238
+ ---
239
+
240
+ ## 🐍 Python Library Usage
241
+
242
+ You can also import `antigravity_export` directly into your own Python applications:
243
+
244
+ ```python
245
+ from antigravity_export import (
246
+ LanguageServerManager,
247
+ LanguageServerClient,
248
+ ConversationRecovery,
249
+ )
250
+ from antigravity_export.exporters import HTMLExporter, MarkdownExporter, JSONExporter
251
+
252
+ # 1. Inspect Language Server connection
253
+ mgr = LanguageServerManager()
254
+ status = mgr.get_status()
255
+ print(f"Server Running: {status.is_running}, Port: {status.port}")
256
+
257
+ # 2. Query conversations via client
258
+ endpoints = mgr.find_all_endpoints()
259
+ client = LanguageServerClient()
260
+ summaries, _, _ = client.get_all_trajectories_merged(endpoints)
261
+
262
+ # 3. Recover an interrupted conversation
263
+ recovery = ConversationRecovery()
264
+ conversation = recovery.recover_conversation("c13776f9-5e3b-49e6-9532-3f19ab2a568a")
265
+
266
+ if conversation:
267
+ print(f"Title: {conversation.title}, Files Changed: {len(conversation.file_changes)}")
268
+
269
+ # Export to HTML
270
+ html_exporter = HTMLExporter(include_thinking=True)
271
+ html_exporter.save(conversation, output_dir=Path("./exports"))
272
+ ```
273
+
274
+ ---
275
+
276
+ ## 🏗️ Architecture & Project Structure
277
+
278
+ ```
279
+ antigravity-export/
280
+ ├── src/
281
+ │ └── antigravity_export/
282
+ │ ├── __init__.py # Package exports and version metadata
283
+ │ ├── __main__.py # CLI invocation via `python -m antigravity_export`
284
+ │ ├── cli.py # Rich + Typer CLI implementation
285
+ │ ├── config.py # System paths (~/.gemini/antigravity) & constants
286
+ │ ├── connection.py # Process detection (WMI/ps), port resolver & health checks
287
+ │ ├── api_client.py # gRPC-Web / HTTP Connect protocol client
288
+ │ ├── models.py # Dataclass models: Conversation, Message, ToolCall, FileChange
289
+ │ ├── parser.py # Multi-modal step parser & unified diff generator
290
+ │ ├── storage.py # SQLite reader (conversation_summaries.db) & brain logs
291
+ │ ├── recovery.py # Crash dump analysis & unindexed conversation recovery
292
+ │ └── exporters/
293
+ │ ├── __init__.py
294
+ │ ├── markdown_exporter.py # GitHub-flavored Markdown formatter
295
+ │ ├── html_exporter.py # Standalone, interactive HTML generator
296
+ │ ├── json_exporter.py # Structured JSON serializer
297
+ │ └── file_changes_exporter.py# Code diffs and .patch generator
298
+ ├── tests/ # Comprehensive pytest test suite
299
+ │ ├── test_models.py
300
+ │ ├── test_parser.py
301
+ │ ├── test_exporters.py
302
+ │ └── test_recovery.py
303
+ ├── pyproject.toml # Modern PEP 621 build configuration
304
+ ├── setup.py # Compatibility installation script
305
+ ├── requirements.txt # Production dependencies
306
+ ├── README.md # English documentation
307
+ └── README.fa.md # Persian documentation (راهنمای فارسی)
308
+ ```
309
+
310
+ ---
311
+
312
+ ## 🧪 Running Tests
313
+
314
+ Run the test suite using `pytest`:
315
+
316
+ ```bash
317
+ pytest
318
+ ```
319
+
320
+ ---
321
+
322
+ ## 📄 License
323
+
324
+ This project is licensed under the [MIT License](LICENSE).
@@ -0,0 +1,286 @@
1
+ # Antigravity Export (agexport)
2
+
3
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
6
+
7
+ A high-performance Python CLI and library to connect directly to the running **Google Antigravity Language Server** (`language_server`), inspect connection state, and export conversations, code modifications, unified git patches, and full reasoning chains into Markdown, self-contained HTML, and JSON. It also features a resilient **Crash Recovery Engine** that can restore unindexed or interrupted sessions directly from SQLite databases and brain logs.
8
+
9
+ [**🇮🇷 مستندات به زبان فارسی (Persian Documentation) در فایل README.fa.md موجود است.**](README.fa.md)
10
+
11
+ ---
12
+
13
+ ## ✨ Features
14
+
15
+ - 🛰️ **Language Server Connectivity**: Automatically discovers running Antigravity Language Server processes, dynamically scans listening ports, retrieves CSRF tokens, and connects over the gRPC-Web / HTTP Connect protocol.
16
+ - 📋 **Chat List & Project Navigation**: List and filter conversations by project, workspace, date, or step count with an interactive Rich terminal interface.
17
+ - 📁 **Multi-Project & Project-Scoped Export**: Export all conversations grouped neatly by project folders, or target a single project or conversation ID.
18
+ - 📝 **Markdown Export (`.md`)**: Clean GitHub-flavored Markdown with conversation metadata, user inputs, collapsible `<details>` tags for AI reasoning/thinking chains, and highlighted tool executions.
19
+ - 🌐 **Self-Contained HTML Export (`.html`)**: Beautiful, responsive, standalone single-page HTML files with modern dark-mode styling, syntax-highlighted unified diffs, collapsible thinking accordions, and zero external CDN dependencies (100% offline viewable).
20
+ - 📑 **Master Table of Contents (`index.html`)**: Automatically generates an interactive Table of Contents dashboard when exporting chats. Features instant search, project filtering pills, summary statistics (total conversations, projects, steps, lines modified), and direct quick-links to HTML, Markdown, JSON, and diff reports.
21
+ - 📊 **Structured JSON Export (`.json`)**: Complete, machine-readable JSON format for programmatic analysis, LLM evals, or database archiving.
22
+ - 🔍 **Dedicated File Changes & Git Patch Exporter**: Extracts all code edits, additions, deletions, unified diffs, and generates standard `.patch` files compatible with `git apply`.
23
+ - 🛡️ **Crash & Update Recovery Engine**: Recovers lost conversations after IDE crashes or updates by scanning `~/.gemini/antigravity/crashes/`, SQLite databases (`conversation_summaries.db`, `conversations/*.db`), and brain transcripts (`transcript_full.jsonl`).
24
+ - ⚡ **Global CLI & Python Library**: Can be installed globally as `agexport` / `antigravity-export` or imported into custom Python scripts.
25
+
26
+ ---
27
+
28
+ ## 🚀 Installation & Setup
29
+
30
+ ### Option 1: Using Virtual Environment (`venv`)
31
+
32
+ ```bash
33
+ # 1. Clone or navigate to the project directory
34
+ cd /path/to/antigravity-export
35
+
36
+ # 2. Create and activate a virtual environment
37
+ python -m venv venv
38
+
39
+ # On Windows (PowerShell):
40
+ .\venv\Scripts\Activate.ps1
41
+ # On macOS/Linux:
42
+ source venv/bin/activate
43
+
44
+ # 3. Install dependencies
45
+ pip install -r requirements.txt
46
+
47
+ # 4. Install the package in editable mode
48
+ pip install -e .
49
+ ```
50
+
51
+ ### Option 2: Global CLI Installation
52
+
53
+ To install globally so that `agexport` is available everywhere in your terminal:
54
+
55
+ ```bash
56
+ # Using standard pip
57
+ pip install .
58
+
59
+ # Or using pipx (recommended for isolated global CLI tools)
60
+ pipx install .
61
+ ```
62
+
63
+ ---
64
+
65
+ ## 💻 CLI Commands & Usage
66
+
67
+ Once installed, the CLI is available as either `agexport` or `antigravity-export`.
68
+
69
+ ### 1. Check Language Server Status
70
+ Verify whether the Antigravity Language Server is running, its PID, port, CSRF token, and storage overview:
71
+
72
+ ```bash
73
+ agexport status
74
+ # or
75
+ agexport info
76
+ ```
77
+
78
+ *Example Output:*
79
+ ```
80
+ Antigravity Language Server Status v1.0.0
81
+
82
+ ┌───────────────────────────┬─────────────────────────────────────────────────┐
83
+ │ Connection State │ CONNECTED │
84
+ │ Process State │ RUNNING │
85
+ │ Process ID (PID) │ 32808 │
86
+ │ Active Port │ 63316 │
87
+ │ CSRF Token │ f442deef-118... │
88
+ │ IDE Name / Version │ antigravity 2.26.0 │
89
+ │ App Data Directory │ C:\Users\user\.gemini\antigravity │
90
+ │ Stored Conversations (DB) │ 6 │
91
+ │ Crash Dumps Detected │ 4 │
92
+ └───────────────────────────┴─────────────────────────────────────────────────┘
93
+
94
+ [OK] Ready for export and real-time interaction (1 active endpoint(s))
95
+ ```
96
+
97
+ ---
98
+
99
+ ### 2. List Conversations
100
+ List active and stored conversations with metadata, project name, step count, and file change metrics:
101
+
102
+ ```bash
103
+ # List latest conversations
104
+ agexport list
105
+
106
+ # Filter conversations by project
107
+ agexport list --project adswinger-ai
108
+
109
+ # Show only today's conversations
110
+ agexport list --today
111
+
112
+ # Output as raw JSON (ideal for piping into jq)
113
+ agexport list --json
114
+ ```
115
+
116
+ ---
117
+
118
+ ### 3. List Projects & Workspaces
119
+ View an aggregated summary of all projects, workspaces, conversation counts, and total file modifications:
120
+
121
+ ```bash
122
+ agexport projects
123
+ ```
124
+
125
+ ---
126
+
127
+ ### 4. Export Conversations
128
+
129
+ Export conversations into Markdown, HTML, JSON, and extract file diffs:
130
+
131
+ ```bash
132
+ # Export all conversations across all projects (organized by project folder)
133
+ agexport export --all-projects -o ./my_exports
134
+
135
+ # Export all conversations for a specific project
136
+ agexport export -p adswinger-ai -o ./my_exports
137
+
138
+ # Export a single conversation by ID
139
+ agexport export --id c13776f9-5e3b-49e6-9532-3f19ab2a568a -o ./single_chat
140
+
141
+ # Export only in Markdown format
142
+ agexport export -f md -o ./markdown_only
143
+
144
+ # Export only in HTML format
145
+ agexport export -f html -o ./html_only
146
+
147
+ # Export only in JSON format
148
+ agexport export -f json -o ./json_only
149
+
150
+ # Exclude AI internal thinking process
151
+ agexport export --no-thinking -o ./concise_exports
152
+
153
+ # Offline export (reads directly from SQLite and brain logs without running server)
154
+ agexport export --all-projects --offline -o ./offline_exports
155
+ ```
156
+
157
+ ---
158
+
159
+ ### 5. Quick One-Shot Full Export
160
+ Shortcut command to export everything in all formats across all projects:
161
+
162
+ ```bash
163
+ agexport export-all -o ./antigravity_export
164
+ ```
165
+
166
+ ---
167
+
168
+ ### 6. Export File Changes & Git Patches
169
+ Specifically extract code modifications, unified diffs, and generate `.patch` files:
170
+
171
+ ```bash
172
+ # Export all file changes across all projects
173
+ agexport export-changes -o ./patches
174
+
175
+ # Export file changes for a specific project
176
+ agexport export-changes -p antigravity-export -o ./patches
177
+ ```
178
+
179
+ Generated files include:
180
+ - `<Title>_<ID>_file_changes.md`: Chronological summary of edits with unified diffs.
181
+ - `<Title>_<ID>.patch`: Standard Git patch file ready to apply via `git apply`.
182
+ - `<Project>_project_file_changes.md`: High-level overview of all modified files.
183
+
184
+ ---
185
+
186
+ ### 7. Recover Lost Conversations After Crashes/Updates
187
+ Scan local crash logs (`~/.gemini/antigravity/crashes/`), unindexed SQLite databases, and brain transcripts to restore lost sessions:
188
+
189
+ ```bash
190
+ # 1. Preview recoverable sessions without writing files (dry-run)
191
+ agexport recover --dry-run
192
+
193
+ # 2. Recover unindexed/lost conversations
194
+ agexport recover -o ./recovered_chats
195
+
196
+ # 3. Force full offline recovery of all sessions on disk
197
+ agexport recover --all --force-offline -o ./full_recovery
198
+ ```
199
+
200
+ ---
201
+
202
+ ## 🐍 Python Library Usage
203
+
204
+ You can also import `antigravity_export` directly into your own Python applications:
205
+
206
+ ```python
207
+ from antigravity_export import (
208
+ LanguageServerManager,
209
+ LanguageServerClient,
210
+ ConversationRecovery,
211
+ )
212
+ from antigravity_export.exporters import HTMLExporter, MarkdownExporter, JSONExporter
213
+
214
+ # 1. Inspect Language Server connection
215
+ mgr = LanguageServerManager()
216
+ status = mgr.get_status()
217
+ print(f"Server Running: {status.is_running}, Port: {status.port}")
218
+
219
+ # 2. Query conversations via client
220
+ endpoints = mgr.find_all_endpoints()
221
+ client = LanguageServerClient()
222
+ summaries, _, _ = client.get_all_trajectories_merged(endpoints)
223
+
224
+ # 3. Recover an interrupted conversation
225
+ recovery = ConversationRecovery()
226
+ conversation = recovery.recover_conversation("c13776f9-5e3b-49e6-9532-3f19ab2a568a")
227
+
228
+ if conversation:
229
+ print(f"Title: {conversation.title}, Files Changed: {len(conversation.file_changes)}")
230
+
231
+ # Export to HTML
232
+ html_exporter = HTMLExporter(include_thinking=True)
233
+ html_exporter.save(conversation, output_dir=Path("./exports"))
234
+ ```
235
+
236
+ ---
237
+
238
+ ## 🏗️ Architecture & Project Structure
239
+
240
+ ```
241
+ antigravity-export/
242
+ ├── src/
243
+ │ └── antigravity_export/
244
+ │ ├── __init__.py # Package exports and version metadata
245
+ │ ├── __main__.py # CLI invocation via `python -m antigravity_export`
246
+ │ ├── cli.py # Rich + Typer CLI implementation
247
+ │ ├── config.py # System paths (~/.gemini/antigravity) & constants
248
+ │ ├── connection.py # Process detection (WMI/ps), port resolver & health checks
249
+ │ ├── api_client.py # gRPC-Web / HTTP Connect protocol client
250
+ │ ├── models.py # Dataclass models: Conversation, Message, ToolCall, FileChange
251
+ │ ├── parser.py # Multi-modal step parser & unified diff generator
252
+ │ ├── storage.py # SQLite reader (conversation_summaries.db) & brain logs
253
+ │ ├── recovery.py # Crash dump analysis & unindexed conversation recovery
254
+ │ └── exporters/
255
+ │ ├── __init__.py
256
+ │ ├── markdown_exporter.py # GitHub-flavored Markdown formatter
257
+ │ ├── html_exporter.py # Standalone, interactive HTML generator
258
+ │ ├── json_exporter.py # Structured JSON serializer
259
+ │ └── file_changes_exporter.py# Code diffs and .patch generator
260
+ ├── tests/ # Comprehensive pytest test suite
261
+ │ ├── test_models.py
262
+ │ ├── test_parser.py
263
+ │ ├── test_exporters.py
264
+ │ └── test_recovery.py
265
+ ├── pyproject.toml # Modern PEP 621 build configuration
266
+ ├── setup.py # Compatibility installation script
267
+ ├── requirements.txt # Production dependencies
268
+ ├── README.md # English documentation
269
+ └── README.fa.md # Persian documentation (راهنمای فارسی)
270
+ ```
271
+
272
+ ---
273
+
274
+ ## 🧪 Running Tests
275
+
276
+ Run the test suite using `pytest`:
277
+
278
+ ```bash
279
+ pytest
280
+ ```
281
+
282
+ ---
283
+
284
+ ## 📄 License
285
+
286
+ This project is licensed under the [MIT License](LICENSE).