@aloth/olcli 0.11.0 → 0.13.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 +109 -2
- package/dist/cli.js +398 -17
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +56 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +61 -4
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +37 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +34 -2
- package/dist/config.js.map +1 -1
- package/dist/diff.d.ts +30 -0
- package/dist/diff.d.ts.map +1 -1
- package/dist/diff.js +34 -0
- package/dist/diff.js.map +1 -1
- package/dist/latexdiff.d.ts +165 -0
- package/dist/latexdiff.d.ts.map +1 -0
- package/dist/latexdiff.js +269 -0
- package/dist/latexdiff.js.map +1 -0
- package/dist/prompt.d.ts +63 -0
- package/dist/prompt.d.ts.map +1 -0
- package/dist/prompt.js +146 -0
- package/dist/prompt.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**Command-line interface for Overleaf** — Sync, manage, and compile LaTeX projects from your terminal.
|
|
4
4
|
|
|
5
|
+
[](https://github.com/aloth/olcli/actions/workflows/ci.yml)
|
|
5
6
|
[](https://www.npmjs.com/package/@aloth/olcli)
|
|
6
7
|
[](https://www.npmjs.com/package/@aloth/olcli)
|
|
7
8
|
[](https://github.com/aloth/olcli)
|
|
@@ -22,6 +23,7 @@ Work with Overleaf projects directly from your command line. Edit locally with y
|
|
|
22
23
|
- ⬆️ **Push** local changes back to Overleaf
|
|
23
24
|
- 🔄 **Sync** bidirectionally with smart conflict detection
|
|
24
25
|
- 🔍 **Diff** local files against the live remote before pushing
|
|
26
|
+
- 📝 **Marked-up revisions** — `diff --latexdiff` produces the struck-through/underlined PDF advisors and journals ask for
|
|
25
27
|
- 🔀 **Git remote** — use Overleaf as a native git remote ([docs](docs/GIT-REMOTE.md))
|
|
26
28
|
- ✌️ **Two-way deletions** — files removed locally are deleted on Overleaf on next sync
|
|
27
29
|
- 🗑️ **Delete** and ✏️ **rename** remote files by path
|
|
@@ -83,9 +85,16 @@ olcli auth --cookie "your_session_cookie_value"
|
|
|
83
85
|
**Email/password** (self-hosted without reCAPTCHA):
|
|
84
86
|
|
|
85
87
|
```bash
|
|
86
|
-
olcli auth --email "you@example.com"
|
|
88
|
+
olcli auth --email "you@example.com"
|
|
89
|
+
# prompts for the password, so it stays out of your shell history
|
|
87
90
|
```
|
|
88
91
|
|
|
92
|
+
The password is **not stored** unless you pass `--save-password`. A session
|
|
93
|
+
cookie is saved either way and is what later commands use; the password only
|
|
94
|
+
buys an automatic re-login once that cookie expires. For scripts, set
|
|
95
|
+
`OVERLEAF_EMAIL` and `OVERLEAF_PASSWORD` — every command reads them, so a
|
|
96
|
+
scripted run never needs `olcli auth` at all.
|
|
97
|
+
|
|
89
98
|
### 2. List Projects
|
|
90
99
|
|
|
91
100
|
```bash
|
|
@@ -128,7 +137,7 @@ All commands auto-detect the project when run from a synced directory (contains
|
|
|
128
137
|
|---------|-------------|
|
|
129
138
|
| `olcli auth` | Set session cookie or login with email/password |
|
|
130
139
|
| `olcli whoami` | Check authentication status |
|
|
131
|
-
| `olcli logout` | Clear
|
|
140
|
+
| `olcli logout` | Clear the global config and the local `.olauth`, reporting each |
|
|
132
141
|
| `olcli list` | List all projects |
|
|
133
142
|
| `olcli info [project]` | Show project details and file list |
|
|
134
143
|
| `olcli pull [project] [dir]` | Download project files to local directory |
|
|
@@ -209,6 +218,7 @@ olcli diff # every changed file, as patches
|
|
|
209
218
|
olcli diff --name-only # just the changed paths
|
|
210
219
|
olcli diff --file main.tex # one file
|
|
211
220
|
olcli diff -U 8 # wider context
|
|
221
|
+
olcli diff --exit-code # exit 1 if anything differs, for CI
|
|
212
222
|
```
|
|
213
223
|
|
|
214
224
|
**The remote side is fetched fresh on every run.** The diff describes the
|
|
@@ -232,6 +242,80 @@ than the last pull, because that is what `push` uploads; `diff` lists files
|
|
|
232
242
|
whose **contents** actually differ. A file you touched without editing appears
|
|
233
243
|
in the first and not the second.
|
|
234
244
|
|
|
245
|
+
#### Marked-up revisions with latexdiff
|
|
246
|
+
|
|
247
|
+
A unified diff is the right artifact for a developer and the wrong one for a
|
|
248
|
+
thesis advisor. `--latexdiff` marks the same revision up inside the document
|
|
249
|
+
instead — deletions struck through, additions underlined — which is what
|
|
250
|
+
advisors and journals ask for.
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
olcli diff --latexdiff # write .olcli-diff/main-diff.tex
|
|
254
|
+
olcli diff --latexdiff --pdf # ...and compile it, download .olcli-diff/main-diff.pdf
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Requires `latexdiff` on your PATH. It ships with TeX Live and MacTeX; nothing
|
|
258
|
+
else in `olcli diff` needs an external tool.
|
|
259
|
+
|
|
260
|
+
**`--pdf` compiles on Overleaf, so you do not need a local TeX installation.**
|
|
261
|
+
The compile endpoint can only build a file that is in the project, so the
|
|
262
|
+
marked-up document is uploaded as `olcli-latexdiff.tex` next to your root
|
|
263
|
+
document, compiled, downloaded, and then removed. The command says so before it
|
|
264
|
+
does it, refuses to overwrite a file of that name if one already exists, and
|
|
265
|
+
prints the exact `olcli rm` command if the cleanup itself fails.
|
|
266
|
+
|
|
267
|
+
`\input` and `\include` are inlined before comparing (`--no-flatten` to opt
|
|
268
|
+
out). Without that, a remote compile would resolve those against the files
|
|
269
|
+
sitting in the project — the old content — and quietly produce a PDF showing
|
|
270
|
+
every input file as unchanged.
|
|
271
|
+
|
|
272
|
+
Output goes to `.olcli-diff/`, which is dotted so that `push` and `sync` never
|
|
273
|
+
pick it up; `-o <path>` puts it elsewhere. The root document is the `.tex` file
|
|
274
|
+
declaring `\documentclass`; if several do, `--main <path>` picks one rather
|
|
275
|
+
than the command guessing. `--latexdiff-opt` passes anything else straight
|
|
276
|
+
through, e.g. `--latexdiff-opt --math-markup=0`.
|
|
277
|
+
|
|
278
|
+
One limit worth knowing: `--pdf` compiles against the project, not against your
|
|
279
|
+
working directory, so anything the markup needs must already be on Overleaf. A
|
|
280
|
+
`.sty` or `.cls` you added locally fails the compile — the compiler log is
|
|
281
|
+
written next to the marked-up source when that happens. A *figure* you added
|
|
282
|
+
locally does not fail it; Overleaf draws a placeholder box naming the missing
|
|
283
|
+
file and the rest of the PDF is fine.
|
|
284
|
+
|
|
285
|
+
#### Using `diff` as a CI gate
|
|
286
|
+
|
|
287
|
+
`--exit-code` turns the command into a check, with the statuses `diff(1)` uses:
|
|
288
|
+
|
|
289
|
+
| Status | Meaning |
|
|
290
|
+
|--------|---------|
|
|
291
|
+
| `0` | Nothing differs |
|
|
292
|
+
| `1` | Something differs |
|
|
293
|
+
| `2` | The run failed — bad flags, no session, project unreachable |
|
|
294
|
+
|
|
295
|
+
```yaml
|
|
296
|
+
- name: Fail if the paper on Overleaf has drifted from the repo
|
|
297
|
+
run: olcli diff --exit-code --name-only
|
|
298
|
+
env:
|
|
299
|
+
OVERLEAF_SESSION: ${{ secrets.OVERLEAF_SESSION }}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
**The `1` versus `2` split is the point of the flag.** Without it a pipeline
|
|
303
|
+
cannot tell a changed file from an expired session cookie, and a job that goes
|
|
304
|
+
red for the second reason sends whoever reads the log hunting for a diff that
|
|
305
|
+
was never computed. Every other olcli command reports failure as `1`, and
|
|
306
|
+
`olcli diff` still does when `--exit-code` is absent, so adding the flag does
|
|
307
|
+
not change what existing scripts see.
|
|
308
|
+
|
|
309
|
+
The gate covers whatever was compared: `--file main.tex` narrows it to one
|
|
310
|
+
file, the way a `git diff --exit-code` pathspec does, and a `--file` that
|
|
311
|
+
matches nothing is `0` rather than an error. Under `--latexdiff` it still
|
|
312
|
+
reports on the project as a whole — a changed figure is a real difference even
|
|
313
|
+
though a marked-up root document cannot show it.
|
|
314
|
+
|
|
315
|
+
Note that this compares against Overleaf **now**, not against your last pull,
|
|
316
|
+
so the check is "has anyone drifted from what is committed here", which is what
|
|
317
|
+
makes it worth running on a schedule as well as on a push.
|
|
318
|
+
|
|
235
319
|
#### How deletion propagation works
|
|
236
320
|
|
|
237
321
|
`olcli` records a manifest of remote files in `.olcli.json`. On next sync:
|
|
@@ -284,6 +368,23 @@ hardcoded here: on macOS it lands under `~/Library/Preferences/`, on Linux under
|
|
|
284
368
|
which is usually your LaTeX project. Add it to that project's `.gitignore`
|
|
285
369
|
before committing.
|
|
286
370
|
|
|
371
|
+
### What is stored, and how to clear it
|
|
372
|
+
|
|
373
|
+
Everything is stored in plaintext, so it is worth knowing what is on disk:
|
|
374
|
+
|
|
375
|
+
| Credential | Stored by default | Where |
|
|
376
|
+
|---|---|---|
|
|
377
|
+
| Session cookie | yes | global config, or `.olauth` with `--save-local` |
|
|
378
|
+
| Email + password | **no** — only with `--save-password` | global config |
|
|
379
|
+
|
|
380
|
+
`olcli check` reports what exists without printing any secret.
|
|
381
|
+
|
|
382
|
+
`olcli logout` clears the global config **and** the `.olauth` file in the
|
|
383
|
+
current directory, then lists what it removed. It cannot unset environment
|
|
384
|
+
variables, so if `OVERLEAF_SESSION` or `OVERLEAF_EMAIL`/`OVERLEAF_PASSWORD` are
|
|
385
|
+
set, it says so instead of implying you are logged out — those take precedence
|
|
386
|
+
over anything on disk.
|
|
387
|
+
|
|
287
388
|
### Self-hosted Overleaf
|
|
288
389
|
|
|
289
390
|
```bash
|
|
@@ -399,6 +500,12 @@ import {
|
|
|
399
500
|
|
|
400
501
|
Contributions are welcome! Please open an issue or submit a pull request.
|
|
401
502
|
|
|
503
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for local setup, which tests need a real
|
|
504
|
+
Overleaf account, and what to expect from CI on a pull request.
|
|
505
|
+
|
|
506
|
+
[docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) explains how the client works —
|
|
507
|
+
there is no public Overleaf API, so it authenticates as a browser session.
|
|
508
|
+
|
|
402
509
|
## License
|
|
403
510
|
|
|
404
511
|
MIT © [Alexander Loth](https://alexloth.com)
|