Skip to content

feat(quark): add Quark Drive adapter#858

Merged
jackwener merged 4 commits intojackwener:mainfrom
xiangzy1:feat/quark-drive
Apr 7, 2026
Merged

feat(quark): add Quark Drive adapter#858
jackwener merged 4 commits intojackwener:mainfrom
xiangzy1:feat/quark-drive

Conversation

@xiangzy1
Copy link
Copy Markdown
Contributor

@xiangzy1 xiangzy1 commented Apr 7, 2026

Summary

  • Add browser-based adapter for Quark Cloud Drive (pan.quark.cn) with cookie strategy
  • 7 commands: ls, mkdir, mv, rename, rm, save, share-tree
  • Shared utilities (utils.ts) with API helpers, folder resolution, task polling, and file formatting
  • Docs: adapter page + sidebar entry + index table row

Test plan

  • opencli quark ls — list root directory
  • opencli quark ls "path" --depth 3 — list with depth
  • opencli quark mkdir "folder" --parent <fid> — create folder
  • opencli quark mv "fid1,fid2" --to "path" — move files
  • opencli quark rename <fid> --name "new.txt" — rename
  • opencli quark rm "fid1,fid2" — delete files
  • opencli quark save <url> --to "path" — save from share link
  • opencli quark share-tree <url> — get share tree as JSON

…, share-tree)

Browser-based adapter for Quark Cloud Drive (pan.quark.cn) using cookie
strategy. Supports file browsing, folder management, and saving shared
files with task polling for async operations.
Copy link
Copy Markdown
Contributor

@Astro-Han Astro-Han left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Useful adapter, and Quark is a sensible target for OpenCLI. The command set also feels about right for a first pass. I do not think this PR is ready yet, though. A few issues are correctness problems, and a few others miss the repo's current adapter standards.

The main code issues:

  • clis/quark/ls.ts: the default --depth 1 behavior is off by one. As written, opencli quark ls walks into child folders instead of only listing the target folder. For an ls command, that default is surprising and can blow up output size on a normal drive.
  • clis/quark/save.ts, clis/quark/mv.ts, clis/quark/utils.ts: save and mv report success before the async task is actually known to have succeeded. Right now a failed or timed out task can still come back as success: true or status: "ok" with completed: false, which hides real failures.
  • clis/quark/save.ts, clis/quark/mv.ts: these commands accept both --to and --to-fid and silently prefer --to-fid. mkdir already rejects the equivalent ambiguous combination, and I think save / mv should do the same.
  • clis/quark/utils.ts: the shared fetch helper assumes every response is JSON and immediately calls r.json(). If Quark returns an HTML login page, challenge page, or any other non-JSON response, this will throw a raw parse error instead of a normal CliError path.

The repo-standard gaps:

  • No adapter tests. This repo already has adapter-level tests and browser auth-failure E2Es. For this PR I would at least expect unit coverage for the helper and validation logic, plus one graceful auth-failure case for quark.
  • Missing README.md and README.zh-CN.md updates. The repo docs currently treat those as part of the deliverables for a new adapter.
  • The new adapter doc is incomplete for a browser adapter. It should mention the Browser Bridge extension in prerequisites, not just "logged in to Quark Drive in Chrome".
  • There is at least one incorrect example in the doc: mkdir --parent <fid> is wrong based on the implementation. --parent is a path, --parent-fid is the raw fid.
  • The command table in the doc should show required positional args the same way other adapter docs do. Right now entries like opencli quark rename are too vague.
  • A short notes section would help here, especially to explain that share-tree returns the stoken needed by save --fids.

From a contributor review perspective, I would fix the success-reporting and ls depth behavior first, then add the missing tests and README/doc follow-through before asking for merge.

xzy and others added 3 commits April 7, 2026 19:52
- ls: fix depth off-by-one (default 0 now lists target folder only)
- save/mv: report success only after pollTask confirms completion; throw on timeout
- save/mv: reject combining --to and --to-fid instead of silently preferring --to-fid
- utils: check content-type before calling r.json() to handle non-JSON responses gracefully
- tests: add quark graceful auth-failure E2E cases for all 7 commands
- docs: add Browser Bridge extension to prerequisites; fix mkdir --parent example; expand command table with positional args; add Notes section explaining stoken flow
@jackwener jackwener merged commit 61b247f into jackwener:main Apr 7, 2026
@jackwener jackwener mentioned this pull request Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants