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.
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.tspullextracts project zips directlysrc/cli.tszipdownloads the archive directlysrc/mcp.tspull_projectextracts directlysrc/remote-helper.tsclone/fetch reads the zip directlysrc/client.tsdownloadByPath()falls back to archive extractionExpected behavior
Proposed direction
OverleafClienthelpers for archive download and extraction.downloadByPath()use the shared archive inspection path instead of creating a one-off unzip flow.Acceptance criteria
downloadByPath()fallback still works for files not reachable by direct entity ID.Files likely affected
src/client.tssrc/cli.tssrc/mcp.tssrc/remote-helper.tsGenerated by GPT-5.4 mini.