AI Chat Exporter
Command Line Interface
Export ChatGPT conversations directly from your terminal.
Overview
The CLI lets you process exported ChatGPT JSON files directly from the terminal and generate clean Markdown documents.
It uses the same modular pipeline as the Chrome Extension, without requiring a browser.
This makes the CLI useful for local processing, automation, experimentation, and integration into other workflows.
Requirements
Node.js 20 — or newer.
The core pipeline has no external npm dependencies. The project uses esbuild as a development dependency for building the Chrome Extension.
Installation
Clone the repository and install the dependencies:
git clone https://github.com/GuillermoCochrane/chat-exporter.git
cd chat-exporter
npm install
Basic Usage
Run the exporter with its default configuration:
npm start
By default, the CLI reads: assets/input/conversation.json
The generated Markdown file is written to: assets/output/conversacion.md
Options
Examples
-
Export using the default paths:
npm start -
Use a custom input file:
npm start -- -i assets/input/conversation.json -
Use a custom output file:
npm start -- -i assets/input/conversation.json -o assets/output/prueba.md -
Enable compact mode:
npm start -- -i assets/input/conversation.json -o assets/output/prueba.md -c -
Export only user messages:
npm start -- -i assets/input/conversation.json -o assets/output/user.md --role user -
Export only assistant messages:
npm start -- -i assets/input/conversation.json -o assets/output/assistant.md --role assistant -
Inspect a conversation without exporting it:
npm start -- --inspect -
Run the pipeline without writing an output file:
npm start -- --no-write
How It Works
The CLI is intentionally thin. It parses the command-line arguments, builds the pipeline configuration, and delegates the actual processing to the shared Core.
CLI
│
▼
Pipeline Profile
│
▼
Pipeline Config
│
▼
runExporter
│
▼
Conversation Source
│
▼
Conversation
│
▼
runPipeline
│
├── Inspector
├── Parser
├── Filter
└── Normalizer
│
▼
Renderer
│
▼
Output
Each module has a single responsibility. The Core does not depend on the interface that started the process or on the destination of the generated result.
The CLI therefore acts as one interface over the same processing engine used by the Chrome Extension.
For a deeper look at the architecture, see the project documentation on GitHub .