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