@aloth/olcli 0.6.0 → 0.8.0

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.
package/README.md CHANGED
@@ -3,7 +3,8 @@
3
3
  **Command-line interface for Overleaf** — Sync, manage, and compile LaTeX projects from your terminal.
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@aloth/olcli.svg)](https://www.npmjs.com/package/@aloth/olcli)
6
- [![AUR Package](https://img.shields.io/aur/version/olcli)](https://aur.archlinux.org/packages/olcli)
6
+ [![npm downloads](https://img.shields.io/npm/dm/@aloth/olcli.svg)](https://www.npmjs.com/package/@aloth/olcli)
7
+ [![GitHub stars](https://img.shields.io/github/stars/aloth/olcli)](https://github.com/aloth/olcli)
7
8
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
9
  [![AgentSkills](https://img.shields.io/badge/AgentSkills-compatible-blue)](https://agentskills.io)
9
10
 
@@ -15,31 +16,30 @@ Work with Overleaf projects directly from your command line. Edit locally with y
15
16
 
16
17
  ## Features
17
18
 
18
- **Full Overleaf command-line access:**
19
-
20
19
  - 📋 **List** all your Overleaf projects
21
20
  - ⬇️ **Pull** project files to local directory for offline editing
22
21
  - ⬆️ **Push** local changes back to Overleaf
23
22
  - 🔄 **Sync** bidirectionally with smart conflict detection
24
- - ✌️ **Two-way deletions** — files removed locally are deleted on Overleaf on the next sync (opt out with `--no-delete`)
23
+ - 🔀 **Git remote** — use Overleaf as a native git remote ([docs](docs/GIT-REMOTE.md))
24
+ - ✌️ **Two-way deletions** — files removed locally are deleted on Overleaf on next sync
25
25
  - 🗑️ **Delete** and ✏️ **rename** remote files by path
26
- - 🚫 **Smart ignore** — LaTeX build artifacts (`.aux`, `.bbl`, `.log`, `.synctex.gz`, …) and OS noise are filtered out automatically; extend with `.olignore` (gitignore-style)
26
+ - 🚫 **Smart ignore** — LaTeX build artifacts and OS noise filtered automatically; extend with `.olignore`
27
27
  - 📄 **Compile** PDFs using Overleaf's remote compiler
28
28
  - 📦 **Download** individual files or full project archives
29
29
  - 📤 **Upload** files to projects
30
- - 💬 **Review comments** — list comments with source locations, add, resolve, reopen, delete threads, and **reply** to existing threads
30
+ - 💬 **Review comments** — list, add, resolve, reopen, delete, and reply to threads
31
31
  - 🗂️ **Preserve folder structure** when pushing nested files
32
- - ⏱️ **Configurable timeout** — global `--timeout <ms>` flag, `OVERLEAF_TIMEOUT` env var, or `config set-timeout` for slow connections
33
- - 🔑 **Password login** — `olcli auth --email --password` for self-hosted instances (no browser required)
34
- - ⚙️ **Support self-hosted Overleaf/ShareLaTeX instances** via configurable base URL and session cookie name
32
+ - ⏱️ **Configurable timeout** for slow connections
33
+ - 🔑 **Password login** for self-hosted instances (no browser required)
34
+ - ⚙️ **Self-hosted Overleaf/ShareLaTeX** support
35
35
  - 📊 **Output** compile artifacts (`.bbl`, `.log`, `.aux` for arXiv submissions)
36
+ - 🤖 **MCP server** for AI assistants ([docs](docs/MCP.md))
36
37
 
37
38
  **Perfect for:**
38
39
  - Editing LaTeX in your preferred text editor (Vim, VS Code, Emacs, etc.)
39
40
  - Version control with Git while using Overleaf's compiler
40
41
  - Automating workflows and CI/CD pipelines
41
42
  - Offline work with periodic sync
42
- - Collaborative projects where some prefer CLI, others prefer web
43
43
 
44
44
  ## Installation
45
45
 
@@ -52,8 +52,6 @@ brew install olcli
52
52
 
53
53
  ### npm (all platforms)
54
54
 
55
- Install globally to use the `olcli` command anywhere:
56
-
57
55
  ```bash
58
56
  npm install -g @aloth/olcli
59
57
  ```
@@ -70,95 +68,55 @@ npx @aloth/olcli list
70
68
  npx skills add aloth/olcli
71
69
  ```
72
70
 
73
- ### Arch Linux
74
-
75
- The package is available on the [Arch User Repository (AUR)](https://aur.archlinux.org/packages/olcli).
76
-
77
- You can install it using your preferred AUR helper (such as `yay` or `paru`):
78
-
79
- ```bash
80
- yay -S olcli
81
- # or
82
- paru -S olcli
83
- ```
84
-
85
- #### Manual Installation:
86
- If you prefer not to use an AUR helper, you can build and install the package manually using makepkg:
87
- code Bash
88
-
89
- ```bash
90
- git clone https://aur.archlinux.org/olcli.git
91
- cd olcli
92
- makepkg -si
93
- ```
94
-
95
71
  ## Quick Start
96
72
 
97
- ### 1. Authenticate with Overleaf
73
+ ### 1. Authenticate
98
74
 
99
- **Option A: Session cookie** (overleaf.com and self-hosted)
100
-
101
- 1. Log into [overleaf.com](https://www.overleaf.com)
102
- 2. Open Developer Tools (F12 or Cmd+Option+I) → Application/Storage → Cookies
103
- 3. Copy the value of `overleaf_session2`
75
+ **Session cookie** (overleaf.com and self-hosted):
104
76
 
105
77
  ```bash
106
78
  olcli auth --cookie "your_session_cookie_value"
107
79
  ```
108
80
 
109
- **Option B: Email/password** (self-hosted instances without reCAPTCHA)
81
+ **Email/password** (self-hosted without reCAPTCHA):
110
82
 
111
83
  ```bash
112
84
  olcli auth --email "you@example.com" --password "your_password"
113
85
  ```
114
86
 
115
- Credentials are stored securely and the session auto-refreshes on expiry.
116
-
117
- **Tip:** The cookie stays valid for weeks. Just refresh it when authentication fails.
118
-
119
- ### 2. List Your Projects
87
+ ### 2. List Projects
120
88
 
121
89
  ```bash
122
90
  olcli list
123
91
  ```
124
92
 
125
- See all your Overleaf projects with IDs and last modified dates.
126
-
127
- ### 3. Pull a Project Locally
128
-
129
- Download any project to work on it locally:
93
+ ### 3. Pull, Edit, Push
130
94
 
131
95
  ```bash
132
96
  olcli pull "My Thesis"
133
97
  cd My_Thesis/
134
- ```
135
-
136
- Now you can edit `.tex` files with your preferred editor (Vim, VS Code, Emacs, etc.).
137
-
138
- ### 4. Edit Locally, Sync to Overleaf
139
-
140
- ```bash
141
- # Edit files locally with your favorite editor
142
98
  vim main.tex
143
-
144
- # Push changes back to Overleaf
145
99
  olcli push
146
-
147
- # Or sync bidirectionally (pull + push in one command)
148
- olcli sync
149
100
  ```
150
101
 
151
- Your collaborators can continue using the Overleaf web editor — changes sync seamlessly.
102
+ ### 4. Compile PDF
152
103
 
153
- ### 5. Compile and Download PDF
104
+ ```bash
105
+ olcli pdf
106
+ # Compile a specific .tex file (for multi-doc projects):
107
+ olcli pdf -r appendix.tex
108
+ ```
154
109
 
155
- Use Overleaf's remote compiler from the command line:
110
+ ### 5. Or use native git commands
156
111
 
157
112
  ```bash
158
- olcli pdf
113
+ git clone overleaf::https://www.overleaf.com/project/<id>
114
+ cd <project>
115
+ # edit, commit, push — standard git workflow
116
+ git push
159
117
  ```
160
118
 
161
- The compiled PDF downloads automatically to your current directory.
119
+ See [Git Remote Helper docs](docs/GIT-REMOTE.md) for details.
162
120
 
163
121
  ## Commands
164
122
 
@@ -174,304 +132,161 @@ All commands auto-detect the project when run from a synced directory (contains
174
132
  | `olcli pull [project] [dir]` | Download project files to local directory |
175
133
  | `olcli push [dir]` | Upload local changes to Overleaf |
176
134
  | `olcli sync [dir]` | Bidirectional sync (pull + push) |
177
- | `olcli upload <file> [project]` | Upload a single file |
135
+ | `olcli upload <file> [project]` | Upload a single file (`--to <path>` sets the remote destination) |
178
136
  | `olcli download <file> [project]` | Download a single file |
179
- | `olcli comments list [project]` | List comments with source text and file locations (`--status`, `--context`) |
180
- | `olcli comments add <file> <message> [project]` | Add a comment to selected text |
181
- | `olcli comments resolve <threadId> [project]` | Resolve a comment thread |
182
- | `olcli comments reply <threadId> <body> [project]` | Reply to a comment thread |
183
- | `olcli comments reopen <threadId> [project]` | Reopen a resolved comment thread |
184
- | `olcli comments delete <threadId> [project]` | Permanently delete a comment thread |
185
- | `olcli delete <file> [project]` | Delete a remote file or folder by path (alias: `rm`) |
186
- | `olcli rename <oldname> <newname> [project]` | Rename a remote file or folder by path (alias: `mv`) |
187
- | `olcli ignored [dir]` | List ignore patterns currently in effect |
188
- | `olcli zip [project]` | Download project as zip archive |
137
+ | `olcli delete <file> [project]` | Delete a remote file or folder (alias: `rm`) |
138
+ | `olcli rename <old> <new> [project]` | Rename a remote file or folder (alias: `mv`) |
189
139
  | `olcli compile [project]` | Trigger PDF compilation |
190
140
  | `olcli pdf [project]` | Compile and download PDF |
191
141
  | `olcli output [type]` | Download compile output files |
192
- | `olcli config set-url <url>` | Set a self-hosted Overleaf base URL |
193
- | `olcli config set-cookie-name <name>` | Set the session cookie name |
194
- | `olcli config set-timeout <ms>` | Set default HTTP request timeout |
195
- | `olcli config get-timeout` | Show current timeout setting |
142
+ | `olcli zip [project]` | Download project as zip archive |
143
+ | `olcli comments list [project]` | List comments (`--status`, `--context`) |
144
+ | `olcli comments add <file> <msg>` | Add a comment to selected text |
145
+ | `olcli comments reply <id> <body>` | Reply to a comment thread |
146
+ | `olcli comments resolve <id>` | Resolve a comment thread |
147
+ | `olcli comments reopen <id>` | Reopen a resolved thread |
148
+ | `olcli comments delete <id>` | Delete a comment thread |
149
+ | `olcli ignored [dir]` | List ignore patterns in effect |
150
+ | `olcli config set-url <url>` | Set self-hosted base URL |
151
+ | `olcli config set-cookie-name <name>` | Set session cookie name |
152
+ | `olcli config set-timeout <ms>` | Set default HTTP timeout |
196
153
  | `olcli check` | Show config paths and credential sources |
197
154
 
198
- ### Review comments
199
-
200
- ```bash
201
- olcli comments list "My Paper" --status open --context 2
202
- olcli comments list "My Paper" --status resolved --json
203
- olcli comments add main.tex "Please clarify this definition" "My Paper" --text "A Skill is"
204
- olcli comments add main.tex "Check this sentence" "My Paper" --line 42 --column 1 --length 20 --json
205
- olcli comments reply 6a1a5fedbf90b811e1000001 "Good point, I'll fix this" "My Paper"
206
- olcli comments resolve 6a1a5fedbf90b811e1000001 "My Paper" --json
207
- olcli comments reopen 6a1a5fedbf90b811e1000001 "My Paper"
208
- olcli comments delete 6a1a5fedbf90b811e1000001 "My Paper" --json
209
- ```
155
+ ### Compile Options
210
156
 
211
- ### Global options
212
-
213
- These flags work with **every** command and may be placed before or after the command name:
157
+ The compile-related commands (`compile`, `pdf`, `output`) accept:
214
158
 
215
159
  | Flag | Description |
216
160
  |------|-------------|
217
- | `--verbose` | Print every HTTP request, status, content-type, and (on errors) a response-body snippet to stderr. Useful for debugging failed compiles, 404s on `pdf`/`output`, auth issues, or unexpected upload behavior. |
218
- | `--base-url <url>` | Override the Overleaf instance base URL (also `OVERLEAF_BASE_URL` env var or `olcli config set-url`). |
219
- | `--cookie-name <name>` | Override the session cookie name (default `overleaf_session2`; older instances use `overleaf.sid`). |
220
- | `--timeout <ms>` | Override the HTTP request timeout in milliseconds (also `OVERLEAF_TIMEOUT` env var or `olcli config set-timeout`). Default: 10000. |
161
+ | `-r, --resource <path>` | Compile a specific `.tex` file as the root document (e.g. `appendix.tex`, `folder/test.tex`) |
221
162
 
222
- Examples:
163
+ Useful in multi-doc projects: each `-r` run compiles the file as if it were the main document.
223
164
 
224
- ```bash
225
- olcli --verbose pdf # see every request the compile makes
226
- olcli pdf --verbose # same thing, flag after command
227
- olcli --verbose sync # debug a sync that's misbehaving
228
- olcli --verbose upload figures/a.png # confirm the file is placed in figures/
229
- ```
230
-
231
- ## Use Cases
232
-
233
- ### Local Editing with Overleaf Compilation
234
-
235
- Work offline in your favorite editor, push when ready, compile remotely:
236
-
237
- ```bash
238
- olcli pull "Research Paper"
239
- cd Research_Paper
240
- vim introduction.tex
241
- git commit -am "Update intro"
242
- olcli push
243
- olcli pdf
244
- ```
245
-
246
- ### Git Version Control + Overleaf
247
-
248
- Keep your LaTeX project in Git while using Overleaf's compiler:
249
-
250
- ```bash
251
- olcli pull "My Thesis" thesis
252
- cd thesis
253
- git init
254
- git add .
255
- git commit -m "Initial import from Overleaf"
256
-
257
- # Daily workflow
258
- vim chapters/methods.tex
259
- git commit -am "Draft methods section"
260
- olcli sync # Sync with Overleaf
261
- olcli pdf
262
- ```
165
+ ### Global Options
263
166
 
264
- ### Automated Workflows
265
-
266
- Integrate Overleaf compilation into CI/CD:
267
-
268
- ```bash
269
- #!/bin/bash
270
- olcli auth --cookie "$OVERLEAF_SESSION"
271
- olcli pull "Automated Report"
272
- ./generate-data.py > tables/results.tex
273
- olcli push
274
- olcli pdf -o report-$(date +%Y-%m-%d).pdf
275
- ```
276
-
277
- ### arXiv Submissions
278
-
279
- Download the `.bbl` file for arXiv submissions:
280
-
281
- ```bash
282
- olcli output bbl --project "My Paper"
283
- # Downloads: bbl
284
- ```
285
-
286
- List all available compile output files:
287
-
288
- ```bash
289
- olcli output --list
290
- # Available output files:
291
- # aux output.aux
292
- # bbl output.bbl
293
- # blg output.blg
294
- # log output.log
295
- # ...
296
- ```
167
+ | Flag | Description |
168
+ |------|-------------|
169
+ | `--verbose` | Print HTTP requests and responses to stderr |
170
+ | `--base-url <url>` | Override Overleaf instance URL |
171
+ | `--cookie-name <name>` | Override session cookie name |
172
+ | `--timeout <ms>` | Override HTTP timeout (default: 10000) |
297
173
 
298
174
  ## Sync Behavior
299
175
 
300
176
  ### Pull
301
177
  - Downloads all files from Overleaf
302
- - **Skips** local files modified after last pull (won't overwrite your changes)
178
+ - Skips local files modified after last pull (won't overwrite your changes)
303
179
  - Use `--force` to overwrite local changes
304
180
 
305
181
  ### Push
306
182
  - Uploads files modified after last pull
307
- - Preserves nested folder structure when uploading
308
- - Filters out LaTeX build artifacts and OS noise (see [Ignoring files](#ignoring-files))
309
- - Use `--all` to upload all files
310
- - Use `--dry-run` to preview changes
311
- - Use `--show-ignored` to see what was filtered out
183
+ - Preserves nested folder structure
184
+ - Filters out LaTeX build artifacts and OS noise
185
+ - Use `--all` to upload all files, `--dry-run` to preview
312
186
 
313
187
  ### Sync
314
- - Pulls remote changes
315
- - Preserves local modifications (local wins if newer)
316
- - Pushes local changes to remote
317
- - **Propagates local deletions to the remote** — if you delete a file locally, it's deleted on Overleaf on the next sync. Use `--no-delete` to opt out.
318
- - Filters out LaTeX build artifacts and OS noise
319
- - Use `--verbose` to see detailed file operations (see [Global options](#global-options))
188
+ - Pulls remote changes, then pushes local changes
189
+ - Local modifications win if newer
190
+ - **Propagates local deletions** — use `--no-delete` to opt out
320
191
  - Use `--dry-run` to preview without applying
321
192
 
322
193
  #### How deletion propagation works
323
194
 
324
- On every sync, `olcli` records a manifest of remote files in `.olcli.json`. The next sync compares the manifest against your local working tree:
195
+ `olcli` records a manifest of remote files in `.olcli.json`. On next sync:
325
196
 
326
- - File missing locally **and** still present on remote → deleted on Overleaf
197
+ - File missing locally + still on remote → deleted on Overleaf
327
198
  - File new locally → uploaded
328
- - File modified locally after last pull → uploaded (local wins)
199
+ - File modified locally → uploaded (local wins)
329
200
  - File only on remote → downloaded
330
201
 
331
- First-time syncs skip the deletion phase (no manifest exists yet to distinguish "never had it" from "deleted it").
332
-
333
- ## Ignoring files
202
+ First-time syncs skip the deletion phase (no prior manifest to compare).
334
203
 
335
- `olcli` automatically filters local files through a layered ignore list before uploading. This keeps LaTeX build artifacts (from local `pdflatex`/`latexmk` runs) and OS noise out of your Overleaf project.
204
+ ## Ignoring Files
336
205
 
337
206
  ### Three layers
338
207
 
339
- | Layer | File | Purpose |
208
+ | Layer | Source | Purpose |
340
209
  |---|---|---|
341
- | 1 | (built-in) | LaTeX intermediates (`.aux`, `.bbl`, `.log`, `.fls`, `.synctex.gz`, beamer/biber/glossaries/minted), OS noise (`.DS_Store`, `Thumbs.db`, `*.swp`), common build dirs (`build/`, `out/`, `_minted-*/`). Always on; opt out with `--no-default-ignore`. |
342
- | 2 | `.olignore` | Project-level patterns, gitignore syntax. Commit alongside your `.tex` sources. |
343
- | 3 | `.olignore.local` | Machine-specific patterns. Add to `.gitignore`. |
210
+ | 1 | Built-in | LaTeX intermediates, OS noise, build dirs. Always on. |
211
+ | 2 | `.olignore` | Project-level patterns (gitignore syntax). |
212
+ | 3 | `.olignore.local` | Machine-specific patterns. |
344
213
 
345
- Later layers override earlier ones, just like git. Negation (`!important.aux`) is supported.
214
+ Later layers override earlier ones. Negation (`!important.aux`) is supported.
346
215
 
347
216
  ### Special PDF rule
348
217
 
349
- `X.pdf` is ignored only if a same-named `X.tex` (or `.ltx`) exists in the same folder. So `thesis.pdf` next to `thesis.tex` is filtered, but a hand-uploaded `figures/diagram.pdf` still syncs.
350
-
351
- ### Example `.olignore`
352
-
353
- ```gitignore
354
- # Drafts that should never reach Overleaf
355
- *.draft.tex
356
- notes/
357
- chapters/scratch/
358
-
359
- # But keep this one auxiliary file
360
- !important.aux
361
- ```
218
+ `X.pdf` is ignored only if `X.tex` (or `.ltx`) exists in the same folder.
362
219
 
363
220
  ### Inspecting and overriding
364
221
 
365
222
  ```bash
366
- olcli ignored # list patterns currently in effect
367
- olcli push --show-ignored # see what was skipped on this run
223
+ olcli ignored # list patterns in effect
224
+ olcli push --show-ignored # see what was skipped
368
225
  olcli sync --no-default-ignore # only .olignore applies
369
- olcli sync --no-ignore # escape hatch — upload everything
226
+ olcli sync --no-ignore # upload everything
370
227
  ```
371
228
 
372
229
  ## Configuration
373
230
 
374
- Credentials are stored in (checked in order):
231
+ Credentials are checked in order:
375
232
 
376
233
  1. `OVERLEAF_SESSION` environment variable
377
234
  2. `.olauth` file in current directory
378
- 3. Global config: `~/.config/olcli-nodejs/config.json` (macOS/Linux)
379
-
380
- ### .olauth File
235
+ 3. Global config: `~/.config/olcli-nodejs/config.json`
381
236
 
382
- For project-specific credentials, create `.olauth` in your project directory:
383
-
384
- ```
385
- s%3AyourSessionCookieValue...
386
- ```
387
-
388
- ### Self-hosted Overleaf / ShareLaTeX
389
-
390
- You can point `olcli` at a self-hosted instance and override the session cookie name. Both flags are documented under [Global options](#global-options) and can be combined with any command.
391
-
392
- ```bash
393
- olcli --base-url https://latex.example.org list
394
- olcli --base-url https://latex.example.org --cookie-name overleaf.sid whoami
395
- ```
396
-
397
- Persist these settings in `olcli` config so you don't have to repeat them:
237
+ ### Self-hosted Overleaf
398
238
 
399
239
  ```bash
400
240
  olcli config set-url https://latex.example.org
401
241
  olcli config set-cookie-name overleaf.sid
402
242
  ```
403
243
 
404
- ### Timeout configuration
244
+ Or pass per-command: `olcli --base-url https://latex.example.org list`
405
245
 
406
- For slow connections or large projects, increase the HTTP request timeout:
246
+ ### Timeout
407
247
 
408
248
  ```bash
409
- # One-off: pass as a flag
410
- olcli --timeout 60000 pull "Large Thesis"
411
-
412
- # Persist as default
413
- olcli config set-timeout 60000
414
-
415
- # Or use environment variable
416
- export OVERLEAF_TIMEOUT=60000
417
- olcli pull "Large Thesis"
249
+ olcli config set-timeout 60000 # persist
250
+ olcli --timeout 60000 pull "Big Thesis" # one-off
251
+ export OVERLEAF_TIMEOUT=60000 # env var
418
252
  ```
419
253
 
420
- Precedence: `--timeout` flag > `OVERLEAF_TIMEOUT` env > `config set-timeout` > default (10000ms).
254
+ Precedence: `--timeout` > `OVERLEAF_TIMEOUT` > config > default (10000ms).
421
255
 
422
256
  ## Examples
423
257
 
424
- ### Work on a thesis
425
-
426
258
  ```bash
427
- # Initial setup
428
- olcli pull "PhD Thesis" thesis
429
- cd thesis
430
-
431
- # Daily workflow
432
- vim chapters/introduction.tex
433
- olcli sync
434
- olcli pdf -o draft.pdf
435
- ```
436
-
437
- ### Quick PDF download
259
+ # Daily thesis workflow
260
+ olcli pull "PhD Thesis" thesis && cd thesis
261
+ vim chapters/methods.tex
262
+ olcli sync && olcli pdf -o draft.pdf
438
263
 
439
- ```bash
264
+ # Quick PDF download
440
265
  olcli pdf "Conference Paper" -o paper.pdf
441
- ```
442
266
 
443
- ### Download a single file
267
+ # Compile a specific root document
268
+ olcli pdf "Conference Paper" -r appendix.tex -o appendix.pdf
269
+ olcli compile "Conference Paper" -r folder/test.tex
444
270
 
445
- ```bash
446
- olcli download main.tex "My Project"
447
- ```
448
-
449
- ### Upload figures
450
-
451
- ```bash
452
- cd my-project
453
- olcli upload figures/diagram.png
454
- ```
271
+ # Upload figures
272
+ olcli upload figures/diagram.png # relative path is preserved
273
+ olcli upload /tmp/build/diagram.png # absolute path lands in the project root
274
+ olcli upload /tmp/build/diagram.png --to figures/diagram.png # explicit destination
455
275
 
456
- ### Backup all projects
276
+ # arXiv submission prep
277
+ olcli output bbl -o main.bbl
278
+ olcli output bbl -r folder/test.tex -o main.bbl # compile artifacts from a specific root doc
279
+ olcli zip -o arxiv-submission.zip
457
280
 
458
- ```bash
281
+ # Backup all projects
459
282
  for proj in $(olcli list --json | jq -r '.[].name'); do
460
283
  olcli zip "$proj" -o "backups/${proj}.zip"
461
284
  done
462
285
  ```
463
286
 
464
- ### Prepare for arXiv
465
-
466
- ```bash
467
- cd my-paper
468
- olcli output bbl -o main.bbl
469
- olcli zip -o arxiv-submission.zip
470
- ```
471
-
472
287
  ## Programmatic Usage (Library API)
473
288
 
474
- `@aloth/olcli` exposes `OverleafClient` and all public interfaces as a proper library so you can use it in your own scripts, tools, and AI agents.
289
+ `@aloth/olcli` exposes `OverleafClient` and all public interfaces as a library.
475
290
 
476
291
  ### Install
477
292
 
@@ -484,27 +299,15 @@ npm install @aloth/olcli
484
299
  ```ts
485
300
  import { OverleafClient } from '@aloth/olcli';
486
301
 
487
- // Create a client from an Overleaf session cookie
488
302
  const client = await OverleafClient.fromSessionCookie(cookie);
489
303
 
490
- // List all projects
491
304
  const projects = await client.listProjects();
492
- console.log(projects);
493
-
494
- // Get detailed info (file tree) for a project
495
305
  const info = await client.getProjectInfo(projectId);
496
-
497
- // Download project as a zip buffer
498
306
  const zipBuf = await client.downloadProject(projectId);
499
-
500
- // Compile and download PDF
501
307
  const pdfBuf = await client.downloadPdf(projectId);
502
308
 
503
- // Upload a file
504
- import { readFileSync } from 'node:fs';
505
309
  await client.uploadFile(projectId, null, 'main.tex', readFileSync('main.tex'));
506
310
 
507
- // List review comments
508
311
  const comments = await client.listComments(projectId, { status: 'open' });
509
312
  ```
510
313
 
@@ -512,167 +315,33 @@ const comments = await client.listComments(projectId, { status: 'open' });
512
315
 
513
316
  ```ts
514
317
  import {
515
- // Core client
516
318
  OverleafClient,
517
-
518
- // Types / interfaces
319
+ // Types
519
320
  Project, ProjectInfo, FolderEntry, DocEntry, FileEntry,
520
321
  CommentMessage, ProjectComment, CommentContext, CommentStatus,
521
322
  ListCommentsOptions, AddCommentOptions, Credentials, SessionCookiePair,
522
-
523
- // Configuration utilities
323
+ // Config utilities
524
324
  getBaseUrl, setBaseUrl, getSessionCookie, setSessionCookie,
525
325
  getSessionCookieName, setSessionCookieName, getCsrf, setCsrf,
526
326
  getLastProject, setLastProject, clearConfig, getConfigPath, saveOlAuth,
527
327
  getTimeout, setTimeout, getPasswordCredentials, setPasswordCredentials,
528
328
  clearPasswordCredentials, type PasswordCredentials,
529
-
530
329
  // Ignore utilities
531
330
  DEFAULT_IGNORE_PATTERNS, loadIgnore, shouldIgnore, buildTexSiblingSet,
532
331
  IgnoreContext, LoadIgnoreOptions,
533
332
  } from '@aloth/olcli';
534
333
  ```
535
334
 
536
- ---
537
-
538
- ## MCP Server
539
-
540
- `@aloth/olcli` ships an [MCP (Model Context Protocol)](https://modelcontextprotocol.io/) server so AI assistants like **Claude Desktop**, **Cursor**, and **Windsurf** can interact with your Overleaf projects directly.
541
-
542
- ### MCP tools
543
-
544
- | Tool | Description |
545
- |------|-------------|
546
- | `list_projects` | List all Overleaf projects |
547
- | `get_project_info` | Get file tree and metadata for a project |
548
- | `pull_project` | Download and extract a project to a local directory |
549
- | `push_file` | Upload a local file to a project |
550
- | `compile` | Compile a project and get the PDF URL |
551
- | `download_pdf` | Compile a project and save the PDF locally |
552
- | `list_comments` | List review comments (filter: all / open / resolved) |
553
- | `get_entities` | Get a flat list of all files in a project |
554
- | `download_file` | Download a specific file by its remote path |
555
- | `add_comment` | Add a review comment to a document |
556
- | `reply_to_comment` | Reply to an existing comment thread |
557
- | `resolve_comment` | Mark a comment thread as resolved |
558
- | `delete_entity` | Delete a file or document by path |
559
- | `rename_entity` | Rename a file or document |
560
- | `compile_with_outputs` | Compile and return all output files (PDF, BBL, logs…) |
561
-
562
- ### Authentication
563
-
564
- The MCP server reads credentials in this order:
565
-
566
- 1. **`OVERLEAF_SESSION` environment variable** — set in your MCP config (recommended)
567
- 2. **`OVERLEAF_EMAIL` + `OVERLEAF_PASSWORD` environment variables** — for password login (self-hosted)
568
- 3. **`.olauth` file in cwd** — written by `olcli auth`
569
- 4. **Stored config** — written by `olcli auth` (including saved password credentials)
570
-
571
- When a session cookie expires and password credentials are available, the MCP server automatically re-authenticates.
572
-
573
- ### Claude Desktop
574
-
575
- Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
576
-
577
- ```json
578
- {
579
- "mcpServers": {
580
- "overleaf": {
581
- "command": "npx",
582
- "args": ["-y", "@aloth/olcli-mcp"],
583
- "env": {
584
- "OVERLEAF_SESSION": "<your-overleaf-session-cookie>"
585
- }
586
- }
587
- }
588
- }
589
- ```
590
-
591
- Or if you have olcli installed globally (`npm install -g @aloth/olcli`):
592
-
593
- ```json
594
- {
595
- "mcpServers": {
596
- "overleaf": {
597
- "command": "olcli-mcp",
598
- "env": {
599
- "OVERLEAF_SESSION": "<your-overleaf-session-cookie>"
600
- }
601
- }
602
- }
603
- }
604
- ```
605
-
606
- ### Cursor
607
-
608
- Add to your Cursor MCP settings (`~/.cursor/mcp.json` or project `.cursor/mcp.json`):
609
-
610
- ```json
611
- {
612
- "mcpServers": {
613
- "overleaf": {
614
- "command": "npx",
615
- "args": ["-y", "@aloth/olcli-mcp"],
616
- "env": {
617
- "OVERLEAF_SESSION": "<your-overleaf-session-cookie>"
618
- }
619
- }
620
- }
621
- }
622
- ```
623
-
624
- ### Windsurf
625
-
626
- Add to `~/.codeium/windsurf/mcp_config.json`:
627
-
628
- ```json
629
- {
630
- "mcpServers": {
631
- "overleaf": {
632
- "command": "npx",
633
- "args": ["-y", "@aloth/olcli-mcp"],
634
- "env": {
635
- "OVERLEAF_SESSION": "<your-overleaf-session-cookie>"
636
- }
637
- }
638
- }
639
- }
640
- ```
641
-
642
- ### Getting your session cookie
643
-
644
- 1. Open Overleaf in your browser and log in
645
- 2. Open DevTools → Application (Chrome) or Storage (Firefox) → Cookies
646
- 3. Find `overleaf_session2` (or `sharelatex.sid` for self-hosted)
647
- 4. Copy the value — that's your `OVERLEAF_SESSION`
335
+ ## Further Documentation
648
336
 
649
- Or run `olcli auth` and then the MCP server will pick it up automatically.
650
-
651
- ### Self-hosted Overleaf
652
-
653
- Set `OVERLEAF_BASE_URL` in your MCP env:
654
-
655
- ```json
656
- "env": {
657
- "OVERLEAF_SESSION": "<cookie>",
658
- "OVERLEAF_BASE_URL": "https://overleaf.yourcompany.com"
659
- }
660
- ```
661
-
662
- ---
337
+ - [MCP Server](docs/MCP.md) — AI assistant integration (Claude, Cursor, Windsurf)
338
+ - [Git Remote Helper](docs/GIT-REMOTE.md) — use Overleaf as a native git remote
663
339
 
664
340
  ## Troubleshooting
665
341
 
666
- ### Session expired
667
-
668
- If you get authentication errors, your session cookie may have expired. Get a fresh one from the browser and run `olcli auth` again.
669
-
670
- ### Compilation fails
342
+ **Session expired** — Get a fresh cookie from the browser and run `olcli auth` again.
671
343
 
672
- Check the Overleaf web editor for detailed error logs. Common issues:
673
- - Missing packages
674
- - Syntax errors in `.tex` files
675
- - Missing bibliography files
344
+ **Compilation fails** — Check the Overleaf web editor for detailed error logs (missing packages, syntax errors, missing bibliography files).
676
345
 
677
346
  ## Contributing
678
347