Skip to content

[Feature] olcli diff — preview content-level changes before push #45

Description

@Waynting

Feature proposal: olcli diff — preview content-level changes before push

Hi! First off, thanks for building olcli — the git remote helper alone has made my Overleaf workflow so much better.

I searched existing issues and didn't find a prior proposal for this.

So I'd like to propose a new command, and I'm happy to lead the implementation myself if you think it fits the project's direction.

Motivation

olcli push --dry-run shows which files would change, but not what changed inside them. Two scenarios where content-level diff matters:

  1. Pre-push sanity check — before pushing, see exactly what edits will land on Overleaf (similar to reviewing git diff before committing).
  2. Academic review workflow — a very common situation: a student revises a thesis locally and wants to show their advisor what changed. Overleaf's web history is limited (especially on free plans) and isn't reviewer-friendly. A marked-up diff PDF (via latexdiff) is the standard way journals and advisors expect to see revisions.

Proposed design

Core command (no external dependencies)

olcli diff [project] [dir]
  • Compares local files against the current remote version
  • Outputs a unified diff to stdout (colorized when TTY)
  • Reuses the existing .olcli.json manifest to determine which files to compare, so it only fetches remote content for files that differ
  • --name-only to list changed files, --file <path> to diff a single file

Optional latexdiff integration (opt-in flags)

olcli diff --latexdiff [--pdf]
  • If latexdiff is available on PATH, generate a marked-up .tex (deletions struck through in red, additions underlined in blue)
  • With --pdf, compile the marked-up file via Overleaf's remote compiler (reusing the existing compile machinery) — so users without a local TeX installation still get a reviewable PDF
  • Gracefully degrades with a clear message if latexdiff isn't installed

Implementation sketch

  • Text diffing via the diff npm package (or similar) — no new heavy deps
  • Remote file contents fetched through the existing OverleafClient methods
  • Binary files (images, PDFs) reported as "binary files differ" only
  • Respects the existing ignore layers (.olignore etc.)

Out of scope (for now)

Keeping the first iteration small on purpose. Possible follow-ups if there's interest: diffing between two points in time via the git remote helper, tagging "review checkpoints", auto-creating a review project on Overleaf.

Questions for you

  1. Does this fit how you see olcli evolving?
  2. Any preference on the diff library, or constraints on new dependencies?
  3. Would you prefer the latexdiff integration split into a separate PR?

If this sounds good, I'll start with a draft PR for the core olcli diff command. Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions