Git + CLI Workflow - Sync, edit, and compile Overleaf LaTeX projects in Zed with intelligent file watching and automatic synchronization.
Inspired by Overleaf Workshop for VS Code, this extension brings seamless Overleaf integration to Zed through a powerful combination of Git and CLI automation.
- 🔐 Cookie-Based Authentication - Secure login with browser session (supports SSO, no password needed)
- 📁 Smart Project Management - CLI tool for easy project setup and management
- 🔄 Real-Time File Sync - Automatic bidirectional sync with file watching
- 🌳 Git Integration - Full Git support for Overleaf Premium users
- 🔨 LaTeX Compilation - One-command compilation with PDF download
- 📝 Complete File Operations - Create, read, update, delete files seamlessly
- ⚡ Auto-commit & push to Git on file changes
- 👀 File watcher with debouncing (2-second wait for batch changes)
- 📊 Beautiful CLI with color-coded output
- 🗂️ Local project organization in
~/.overleaf-zed/projects/ - 🔧 Extensible API for custom workflows
# Clone and setup everything automatically
git clone https://github.com/YOUR_GITHUB_USERNAME/overleaf-zed-extension.git
cd overleaf-zed-extension
./setup.sh# 1. Install Node.js dependencies
cd server && npm install
# 2. Install CLI tool globally
npm link
# 3. Build Zed extension (if you have Rust)
cd .. && cargo build --releaseoverleaf-cli login
# Paste your cookie when promptedHow to get your cookie:
- Login to Overleaf in your browser
- Press
F12→ Console tab - Run:
document.cookie.split(';').find(c => c.includes('overleaf_session2')) - Copy the output
overleaf-cli list
# Shows all your projects with IDs# Interactive mode (choose from list)
overleaf-cli setup
# Or specify project ID directly
overleaf-cli setup 68c0b895d8bca38ce7a59ba6This will:
- ✅ Try Git clone first (for Premium users)
- ✅ Fallback to direct download if Git fails
- ✅ Save to
~/.overleaf-zed/projects/YourProject/ - ✅ Initialize local Git repo
cd ~/.overleaf-zed/projects/YourProject
zed .# In project directory
overleaf-cli watch
# Now every file change automatically:
# 1. Uploads to Overleaf (2 sec delay)
# 2. Commits to Git locally
# 3. Pushes to remote (if configured)overleaf-cli compile
# PDF saved at: output.pdf# Clone with official Git URL
overleaf-cli setup
# Enable Git remote for push/pull
cd ~/.overleaf-zed/projects/YourProject
git remote add overleaf https://git.overleaf.com/68c0b895d8bca38ce7a59ba6
# Work normally with Git
git pull overleaf master
git push overleaf masteroverleaf-zed-extension/
├── setup.sh # One-command setup script
├── extension.toml # Zed extension manifest
├── Cargo.toml # Rust dependencies
├── src/
│ └── lib.rs # Zed extension (WebAssembly)
├── server/
│ ├── package.json # Node.js dependencies
│ ├── index.js # Local sync service for CLI
│ ├── cli.js # CLI tool
│ ├── file-watcher.js # File watching & auto-sync
│ └── overleaf-api.js # Overleaf API client
├── LICENSE # MIT License
└── README.md # This file
1. overleaf-cli setup # Download project
2. cd project && zed . # Open in Zed
3. Edit files... # Work normally
4. overleaf-cli compile # Compile when ready1. overleaf-cli setup # Download project
2. cd project
3. overleaf-cli watch & # Start background sync
4. zed . # Open in Zed
# All changes auto-sync to Overleaf every 2 seconds1. overleaf-cli setup # Clone via Git
2. cd project && zed .
3. git add . && git commit # Standard Git workflow
4. git push # Push to Overleaf~/.overleaf-zed/config.json
{
"cookie": "overleaf_session2=...",
"email": "[email protected]",
"serverUrl": "https://www.overleaf.com"
}~/.overleaf-zed/projects/
Each project folder contains:
.overleaf-meta.json- Project metadata.git/- Git repository (if initialized)- Your LaTeX files
- CSRF Token Fix: Properly extracts CSRF tokens from Overleaf HTML for write operations
- Auto-Push System: Automatically commits and pushes changes to Git remote on file save
- Recursive Folder Creation: Sync now creates nested folders automatically
- Improved Error Handling: Better error messages for authentication and network issues
- File Watcher Stability: Debounced file watching (2-second delay) prevents duplicate uploads
-
Smart Git Integration
- Automatically adds
overleafremote during setup - Auto-commit with descriptive messages on every change
- Auto-push to Overleaf Git repository (for Premium users)
- Automatically adds
-
CLI Improvements
- Color-coded output for better readability
- Interactive project selection
- Automatic fallback from Git to direct download
-
CSRF Token Extraction
⚠️ - Issue: CSRF token sometimes fails to extract from Overleaf HTML
- Impact: Write operations (upload/delete files, compile) may fail
- Workaround: Get a fresh cookie with
overleaf-cli login - Status: Under investigation - Overleaf may have changed their HTML structure
-
File Watcher Performance
⚠️ - Issue: Watching large projects (>100 files) can be slow
- Workaround: Use Git workflow instead of
watchcommand - Status: Considering optimization options
# Re-login with fresh cookie
overleaf-cli login# Check if watcher is running
ps aux | grep "overleaf-cli watch"
# Restart watcher
pkill -f "overleaf-cli watch"
overleaf-cli watch- Expected for free accounts - Overleaf Git access requires Premium
- The CLI automatically falls back to direct download
- A local Git repo is still created for version control
- You can still use Git locally, just can't push to Overleaf remote
⚠️ Warning: No CSRF token found
- Most read operations work fine without CSRF token
- Write operations (upload, delete, compile) may fail
- Solution: Get a fresh cookie with
overleaf-cli login
# Check if remote is configured
git remote -v
# Add Overleaf remote if missing
git remote add overleaf https://git.overleaf.com/YOUR_PROJECT_ID
# Test manual push
git push overleaf master# Enable verbose logging
DEBUG=overleaf:* overleaf-cli watch# Remove all cached data
rm -rf ~/.overleaf-zed/cache/
# Re-login
overleaf-cli login# List projects to test authentication
overleaf-cli list
# If this fails, check:
# 1. Cookie is valid (login to Overleaf in browser first)
# 2. Network connection works
# 3. Overleaf service is not down| Feature | Overleaf Workshop (VS Code) | This Extension (Zed) |
|---|---|---|
| Virtual Filesystem | ✅ Yes | ❌ No (Zed limitation) |
| Real-time Collaboration | ✅ WebSocket | |
| File Sync | ✅ Automatic | ✅ Auto via watcher |
| Git Integration | ❌ No | ✅ Yes (Premium) |
| CLI Tool | ❌ No | ✅ Yes |
| Auto Git Commit | ❌ No | ✅ Yes |
| PDF Preview | ✅ In-editor |
Contributions are welcome! Here are some ideas:
- Add WebSocket support for real-time collaboration
- Implement in-editor PDF preview
- Add SyncTeX support (PDF ↔ source jumping)
- Create GUI for project management
- Support for self-hosted Overleaf instances
To contribute:
- Fork the repository
- Create a feature branch
- Submit a pull request
- Inspired by Overleaf Workshop for VS Code
- API implementation based on reverse-engineering by @iamhyc
- Built for Zed Editor by Zed Industries
MIT License - see LICENSE for details.
If this project helps you, please consider giving it a ⭐ on GitHub!
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: [email protected]
# After installation:
overleaf-commit # Smart commit with AI-generated message
overleaf-sync # Sync from Overleaf to local
git pull overleaf master # Pull from Overleaf (Git method)
git push overleaf master # Push to Overleaf (Git method)Made with ❤️ for the LaTeX & Zed community