@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 +100 -413
- package/dist/cli.js +120 -20
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +18 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +126 -21
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +25 -1
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +31 -5
- package/dist/mcp.js.map +1 -1
- package/dist/remote-helper.d.ts +16 -0
- package/dist/remote-helper.d.ts.map +1 -0
- package/dist/remote-helper.js +431 -0
- package/dist/remote-helper.js.map +1 -0
- package/package.json +3 -2
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
|
[](https://www.npmjs.com/package/@aloth/olcli)
|
|
6
|
-
[](https://www.npmjs.com/package/@aloth/olcli)
|
|
7
|
+
[](https://github.com/aloth/olcli)
|
|
7
8
|
[](https://opensource.org/licenses/MIT)
|
|
8
9
|
[](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
|
-
-
|
|
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
|
|
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
|
|
30
|
+
- 💬 **Review comments** — list, add, resolve, reopen, delete, and reply to threads
|
|
31
31
|
- 🗂️ **Preserve folder structure** when pushing nested files
|
|
32
|
-
-
|
|
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
|
-
|
|
71
|
+
## Quick Start
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
### 1. Authenticate
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
**Session cookie** (overleaf.com and self-hosted):
|
|
76
76
|
|
|
77
77
|
```bash
|
|
78
|
-
|
|
79
|
-
# or
|
|
80
|
-
paru -S olcli
|
|
78
|
+
olcli auth --cookie "your_session_cookie_value"
|
|
81
79
|
```
|
|
82
80
|
|
|
83
|
-
|
|
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
|
-
|
|
89
|
-
cd olcli
|
|
90
|
-
makepkg -si
|
|
84
|
+
olcli auth --email "you@example.com" --password "your_password"
|
|
91
85
|
```
|
|
92
86
|
|
|
93
|
-
|
|
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
|
-
|
|
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
|
-
|
|
102
|
+
### 4. Compile PDF
|
|
144
103
|
|
|
145
|
-
|
|
104
|
+
```bash
|
|
105
|
+
olcli pdf
|
|
106
|
+
```
|
|
146
107
|
|
|
147
|
-
|
|
108
|
+
### 5. Or use native git commands
|
|
148
109
|
|
|
149
110
|
```bash
|
|
150
|
-
|
|
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
|
-
|
|
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
|
|
172
|
-
| `olcli
|
|
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
|
|
184
|
-
| `olcli
|
|
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
|
-
###
|
|
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
|
|
206
|
-
| `--base-url <url>` | Override
|
|
207
|
-
| `--cookie-name <name>` | Override
|
|
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
|
-
-
|
|
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
|
|
295
|
-
- Filters out LaTeX build artifacts and OS noise
|
|
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
|
-
-
|
|
303
|
-
-
|
|
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
|
-
|
|
183
|
+
`olcli` records a manifest of remote files in `.olcli.json`. On next sync:
|
|
312
184
|
|
|
313
|
-
- File missing locally
|
|
185
|
+
- File missing locally + still on remote → deleted on Overleaf
|
|
314
186
|
- File new locally → uploaded
|
|
315
|
-
- File modified locally
|
|
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
|
|
319
|
-
|
|
320
|
-
## Ignoring files
|
|
190
|
+
First-time syncs skip the deletion phase (no prior manifest to compare).
|
|
321
191
|
|
|
322
|
-
|
|
192
|
+
## Ignoring Files
|
|
323
193
|
|
|
324
194
|
### Three layers
|
|
325
195
|
|
|
326
|
-
| Layer |
|
|
196
|
+
| Layer | Source | Purpose |
|
|
327
197
|
|---|---|---|
|
|
328
|
-
| 1 |
|
|
329
|
-
| 2 | `.olignore` | Project-level patterns
|
|
330
|
-
| 3 | `.olignore.local` | Machine-specific patterns.
|
|
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
|
|
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
|
|
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
|
|
354
|
-
olcli push --show-ignored # see what was skipped
|
|
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 #
|
|
214
|
+
olcli sync --no-ignore # upload everything
|
|
357
215
|
```
|
|
358
216
|
|
|
359
217
|
## Configuration
|
|
360
218
|
|
|
361
|
-
Credentials are
|
|
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`
|
|
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
|
-
|
|
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
|
-
|
|
232
|
+
Or pass per-command: `olcli --base-url https://latex.example.org list`
|
|
392
233
|
|
|
393
|
-
###
|
|
234
|
+
### Timeout
|
|
394
235
|
|
|
395
236
|
```bash
|
|
396
|
-
#
|
|
397
|
-
olcli pull "
|
|
398
|
-
|
|
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
|
-
|
|
242
|
+
Precedence: `--timeout` > `OVERLEAF_TIMEOUT` > config > default (10000ms).
|
|
407
243
|
|
|
408
|
-
|
|
409
|
-
olcli pdf "Conference Paper" -o paper.pdf
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
### Download a single file
|
|
244
|
+
## Examples
|
|
413
245
|
|
|
414
246
|
```bash
|
|
415
|
-
|
|
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
|
-
|
|
252
|
+
# Quick PDF download
|
|
253
|
+
olcli pdf "Conference Paper" -o paper.pdf
|
|
419
254
|
|
|
420
|
-
|
|
421
|
-
cd my-project
|
|
255
|
+
# Upload figures
|
|
422
256
|
olcli upload figures/diagram.png
|
|
423
|
-
```
|
|
424
257
|
|
|
425
|
-
|
|
258
|
+
# arXiv submission prep
|
|
259
|
+
olcli output bbl -o main.bbl
|
|
260
|
+
olcli zip -o arxiv-submission.zip
|
|
426
261
|
|
|
427
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|