Files
jackwener__opencli/docs/adapters/browser/quark.md
X 61b247f90c feat(quark): add Quark Drive adapter (#858)
* feat(quark): add Quark Drive adapter (ls, mkdir, mv, rename, rm, save, 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.

* fix(quark): address review feedback on adapter correctness and docs

- 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

* fix(quark): map auth failures and cover utils

* fix(quark): reuse auth mapping for share-tree

---------

Co-authored-by: xzy <xzy@mbp-m5.local>
Co-authored-by: jackwener <jakevingoo@gmail.com>
2026-04-08 00:28:59 +08:00

2.0 KiB

Quark Drive

Mode: 🔐 Browser · Domain: pan.quark.cn

Prerequisites

Commands

Command Description
opencli quark ls [path] List files in your Quark Drive
opencli quark mkdir <name> Create a folder
opencli quark mv <fids> Move files to a folder
opencli quark rename <fid> Rename a file or folder
opencli quark rm <fids> Delete files
opencli quark save <url> Save shared files to your Drive
opencli quark share-tree <url> Get directory tree from a share link as nested JSON

Usage Examples

# List root directory
opencli quark ls

# List a specific folder with depth 3
opencli quark ls "Documents/Projects" --depth 3

# Create a folder in root
opencli quark mkdir "New Folder"

# Create a folder inside a specific parent (by path)
opencli quark mkdir "Sub Folder" --parent "Documents"

# Create a folder inside a specific parent (by fid)
opencli quark mkdir "Sub Folder" --parent-fid <fid>

# Move files to a folder
opencli quark mv "fid1,fid2" --to "Documents"

# Rename a file
opencli quark rename <fid> --name "new-name.txt"

# Delete files
opencli quark rm "fid1,fid2"

# Save all files from a share link
opencli quark save https://pan.quark.cn/s/abc123 --to "来自:分享"

# Save specific files by fid (get fids from share-tree)
opencli quark save https://pan.quark.cn/s/abc123 --to "My Folder" --fids "fid1,fid2" --stoken <stoken>

# Save to a specific folder by fid
opencli quark save https://pan.quark.cn/s/abc123 --to-fid <fid>

# Move files to a folder by fid
opencli quark mv "fid1,fid2" --to-fid <fid>

# Get full tree from a share link
opencli quark share-tree https://pan.quark.cn/s/abc123

Notes

  • share-tree returns a stoken value that is required when using save --fids to save specific files from a share link.
  • --to resolves a folder path by name; --to-fid uses a folder ID directly. These flags cannot be combined.