npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ai-chat-export

v1.0.2

Published

Export AI chat conversations (Gemini, ChatGPT, Copilot, DeepSeek) to Markdown and JSON. Uses AppleScript to control Chrome — no API keys needed.

Readme

ai-chat-export

Export your AI chat conversations to Markdown and JSON files — for backup, analysis, or feeding to other AI tools.

Supported providers:

| Provider | Status | |----------|--------| | Google Gemini | Available | | ChatGPT | Coming soon | | Microsoft Copilot | Coming soon | | DeepSeek | Coming soon |

Most AI chat platforms don't offer full conversation export. Google Takeout doesn't support Gemini chats at all. This tool fills that gap.

Why AppleScript?

We tried every reasonable approach before landing on AppleScript:

| Approach | Result | |---|---| | Playwright launchPersistentContext | Chrome blocks --remote-debugging-pipe on its default user data directory | | Copy Chrome profile to temp dir | Cookies are encrypted via macOS Keychain — copied profile loses authentication | | --remote-debugging-port on default profile | Same restriction — Chrome refuses remote debugging on its standard data directory | | Symlink trick | Chrome resolves symlinks, still detects the default directory | | Copy profile + --user-data-dir | CDP works, but cookies can't be decrypted in the new location |

AppleScript controls the real Chrome process with real cookies — no profile copying, no CDP, no authentication issues. The tradeoff is macOS-only.

Prerequisites

  • macOS (AppleScript requirement)
  • Google Chrome open and signed in to your AI provider
  • Allow JavaScript from Apple Events — in Chrome: View > Developer > Allow JavaScript from Apple Events

Quick Start

npx ai-chat-export

This exports all your Gemini conversations as Markdown files to ./ai-chats/.

CLI Options

| Option | Short | Default | Description | |---|---|---|---| | --provider <name> | -p | gemini | AI provider to export from | | --output <dir> | -o | ./ai-chats | Output directory | | --format <type> | -f | markdown | Output format: markdown, json, or both | | --delay <ms> | -d | 3000 | Delay between chat exports (ms) | | --verbose | -v | false | Enable debug logging | | --help | -h | | Show help message |

Examples

# Export Gemini chats as JSON (for programmatic analysis)
npx ai-chat-export --format json

# Export both Markdown and JSON
npx ai-chat-export --format both --output ~/my-exports

# Slower export (for rate limiting concerns)
npx ai-chat-export --delay 5000

# Debug mode
npx ai-chat-export --verbose

Output Formats

Markdown (default)

# How to make sourdough bread

## User

How do I make sourdough bread from scratch?

---

## Gemini

Here's a step-by-step guide to making sourdough bread...

---

JSON

{
  "title": "How to make sourdough bread",
  "url": "https://gemini.google.com/app/abc123",
  "exportedAt": "2025-01-15T10:30:00.000Z",
  "messages": [
    { "role": "User", "content": "How do I make sourdough bread from scratch?" },
    { "role": "Gemini", "content": "Here's a step-by-step guide to making sourdough bread..." }
  ]
}

How It Works

  1. AppleScript bridge — Executes JavaScript in Chrome's active tab via osascript
  2. Sidebar scanning — Opens the sidebar and scrolls to load all lazy-loaded conversations
  3. Link collection — Extracts all chat URLs, filtering out non-chat links
  4. Message extraction — Navigates to each chat and extracts messages using multiple fallback DOM strategies
  5. Formatting — Converts extracted messages to Markdown and/or JSON

Adding a New Provider

Each provider is a single file in src/providers/ that exports:

export const name = "provider-id";
export const displayName = "Provider Name";
export const url = "https://provider.example.com";
export function checkSignedIn() { /* ... */ }
export async function collectChats({ verbose }) { /* ... */ }
export async function extractMessages() { /* ... */ }

See src/providers/gemini.mjs for a complete example.

Limitations

  • macOS only — AppleScript is a macOS technology
  • Chrome only — Uses Chrome-specific AppleScript commands
  • DOM-dependent — Message extraction relies on each provider's DOM structure, which may change
  • Sequential — Exports one chat at a time (no parallel extraction)
  • No retry — Failed chats are skipped without retry

Future Work

  • [ ] More providers — ChatGPT, Microsoft Copilot, DeepSeek
  • [ ] Windows/Linux support — CDP-based approach where user launches Chrome with --remote-debugging-port on a separate --user-data-dir, signs in once, then tool connects via CDP
  • [ ] Retry logic — Retry failed chat exports
  • [ ] Incremental export — Skip chats already exported (by checking existing files)

Use with Claude Code

This repo is a Claude Code plugin. Install it and get the /ai-chat-export slash command:

/plugin install https://github.com/ktundwal/ai-chat-export

Then use it:

/ai-chat-export
/ai-chat-export --provider gemini --format json --output ~/exports

Contributing

Contributions welcome — especially new providers! See CLAUDE.md for development guidelines.

License

MIT