feat(quark): add Quark Drive adapter#858
Merged
jackwener merged 4 commits intojackwener:mainfrom Apr 7, 2026
Merged
Conversation
…, 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.
Astro-Han
reviewed
Apr 7, 2026
Contributor
Astro-Han
left a comment
There was a problem hiding this comment.
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 1behavior is off by one. As written,opencli quark lswalks into child folders instead of only listing the target folder. For anlscommand, 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:saveandmvreport success before the async task is actually known to have succeeded. Right now a failed or timed out task can still come back assuccess: trueorstatus: "ok"withcompleted: false, which hides real failures.clis/quark/save.ts,clis/quark/mv.ts: these commands accept both--toand--to-fidand silently prefer--to-fid.mkdiralready rejects the equivalent ambiguous combination, and I thinksave/mvshould do the same.clis/quark/utils.ts: the shared fetch helper assumes every response is JSON and immediately callsr.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 normalCliErrorpath.
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.mdandREADME.zh-CN.mdupdates. 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.--parentis a path,--parent-fidis 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 renameare too vague. - A short notes section would help here, especially to explain that
share-treereturns thestokenneeded bysave --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.
- 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
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pan.quark.cn) with cookie strategyls,mkdir,mv,rename,rm,save,share-treeutils.ts) with API helpers, folder resolution, task polling, and file formattingTest plan
opencli quark ls— list root directoryopencli quark ls "path" --depth 3— list with depthopencli quark mkdir "folder" --parent <fid>— create folderopencli quark mv "fid1,fid2" --to "path"— move filesopencli quark rename <fid> --name "new.txt"— renameopencli quark rm "fid1,fid2"— delete filesopencli quark save <url> --to "path"— save from share linkopencli quark share-tree <url>— get share tree as JSON