Skip to content

Consolidate archive extraction logic across CLI, MCP, and git remote #3

Description

@dkritarth

Problem

Archive handling logic is duplicated across the CLI, MCP server, git remote helper, and downloadByPath() fallback. Each place currently unpacks Overleaf project zips independently, which increases the chance of drift and makes large-project fixes harder to apply consistently.

Current duplication

  • src/cli.ts pull extracts project zips directly
  • src/cli.ts zip downloads the archive directly
  • src/mcp.ts pull_project extracts directly
  • src/remote-helper.ts clone/fetch reads the zip directly
  • src/client.ts downloadByPath() falls back to archive extraction

Expected behavior

  • One shared implementation should cover archive download/extract behavior.
  • Command layers should mostly orchestrate input/output instead of reimplementing zip logic.
  • The same fix for large-project handling should automatically apply to CLI, MCP, and git remote paths.

Proposed direction

  • Add shared OverleafClient helpers for archive download and extraction.
  • Prefer file-backed extraction or stream-based entry iteration.
  • Make downloadByPath() use the shared archive inspection path instead of creating a one-off unzip flow.

Acceptance criteria

  • CLI, MCP, and git remote all use the same archive extraction path.
  • downloadByPath() fallback still works for files not reachable by direct entity ID.
  • The shared implementation is the only place that needs future archive-handling fixes.
  • There is no user-visible change in output format or command behavior beyond improved reliability.

Files likely affected

  • src/client.ts
  • src/cli.ts
  • src/mcp.ts
  • src/remote-helper.ts

Generated by GPT-5.4 mini.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions