SuperAPI AI Directory

soia-pkm-baidu-netdisk-ops

Office & productivity

View repository

Updated 10-16 08:44

About this skill

soia-pkm-baidu-netdisk-ops — Baidu Netdisk atomic operation layer

Customer-readable description

This skill connects the official Baidu baidu-drive Skill and bdpan CLI to the PKM workflow, responsible for safe Baidu Netdisk atomic operations and read-only resource scanning.

Positioning

This skill is the Baidu Netdisk adapter for the PKM layer, using the official Baidu public baidu-drive Skill and its bdpan CLI by default, and can also explicitly switch to the community mqhe2007/baidupan-cli for open platform application directory testing. Both backends are selected by the same private configuration; this skill adds PKM-oriented security boundaries, read-only scanning, and standard JSONL output.

It is not responsible for automatically organizing directories, generating holdings, or creating study plans; these should be handled by the upper-layer curator skill consuming the scan results.

What this skill can do

Customer wants Skill will do Customer can see
Log in to or verify Baidu Netdisk Check bdpan, version, and login state; complete authorization according to the official script Official authorization address, non-sensitive status, and verification results; does not display token or configuration files
Browse directories or search files Use ls --json / search --json Remote scope, entries, and failure reasons
Transfer or manage files Upload, download, share, save, move, copy, rename, create directory Expected scope, execution results, conflict policy, and final state verification
Build full-disk index input Run read-only DFS, generate JSONL and .errors/.progress/.done sidecar Scan statistics, error count, and output location

The official bdpan intentionally does not provide a delete command. This skill does not add deletion through other clients, and does not use web cookies, BDUSS, or undisclosed APIs.

How customers use it

Describe the goal in natural language, and provide the remote virtual path (such as /资料) and the necessary local target path. The Agent will first check dependencies and login state; when upload, download, sharing, saving, or remote organization is involved, it will first show the exact scope and conflict policy, then execute after confirmation and read back for verification.

Dependencies and installation

Prefer to install the official Baidu upstream Skill:

npx skills add https://github.com/baidu-netdisk/bdpan-storage/skills --skill baidu-drive

Then follow the upstream baidu-drive/SKILL.md operation:

  1. By upstream scripts/install.sh install bdpan(the current upstream installer version must be based on the repository; the installation script is downloaded from the Baidu CDN, and the script and network source should be reviewed before execution).
  2. Before logging in, first check whether bdpan help login contains --device-code: when supported, the Agent directly executes this skill'sdevice code login entry, automatically generates the authorization link/QR code and waits for the customer to authorize on the Baidu page or App; this entry automatically passes --accept-disclaimer, and the customer does not need to enter Y or the authorization code in the terminal. Only when an older version does not support device code should it fall back to the upstream scripts/login.sh --yes; at this time --yes only skips the script security notice prompt already shown to the customer, and authorization is still completed by the customer.
  3. Run bdpan whoami to verify the login state.

The upstream Skill's path is its own installation directory; do not mistake this skill's directory for the upstream directory. When the upstream Skill is missing, stop and prompt to install the dependency. Installation, login, and updates all require the user's explicit intent; do not trigger them silently. After the customer explicitly requests login,--yes is only used to skip the script disclaimer that has already been shown; it does not mean completing Baidu authorization on the customer's behalf.

Community mode requires AppKey, SecretKey, and the application name; official mode does not require these variables. For the facts, limitations, and switching boundaries of the two backends, see provider-cli.md。

Private configuration and path contract

  • Private configuration is placed by default at:

    ~/.config/soia-skills/soia-open-skills/soia-pkm/soia-pkm-baidu-netdisk-ops/config.yml
    

    Can be overridden with SOIA_PKM_BAIDU_NETDISK_OPS_CONFIG_FILE=<custom-config-path> . Copy this skill's config.example.yml and fill it in according to the selected backend; do not put private config.yml back into the repository.

  • The only configuration options are provider: official|community and the optional binary: bdpan|baidupan-cli。binary is only used to select the CLI; by default, select according to provider .

  • The official provider configuration is maintained by bdpan itself in ~/.config/bdpan/config.json. The Agent does not read, print, or copy this file, nor does it actively set BDPAN_CONFIG_PATH、BDPAN_BIN or BDPAN_INSTALL_DIR。

  • The community provider only reads from the private configuration's env: Read BAIDUPAN_APP_KEY、BAIDUPAN_APP_SECRET、BAIDUPAN_APP_NAME and the optional BAIDUPAN_CRYPTO_PASSPHRASE; the process environment takes precedence over the configuration file. The wrapper does not perform shell interpolation and does not print these values.

  • The official application isolation root is /apps/bdpan/; the user-visible name is usually 我的应用数据/bdpan/. Use relative paths or this skill's virtual paths for display to users and command input, for example /资料、/资料/a.pdf; do not expose the full provider prefix to users.

  • Paths are prohibited from containing .. or ~, and do not treat local absolute paths as remote paths. Before writing, check the source, the target parent directory, and the conflict policy.

  • bdpan The JSON fields of fs_id、server_filename、isdir、size、md5、server_mtime are primarily

Standard workflow

1. Installation and login

python3 <skill-path>/scripts/run_with_env.py -- version
python3 <skill-path>/scripts/run_with_env.py -- whoami

The wrapper selects config.yml according to bdpan or baidupan-cli. If the official mode's bdpan does not exist, first ask the user to confirm, then run the upstream installation script; if the community mode's baidupan-cli does not exist, install it from its Releases . When official mode login is invalid, first check whether the current CLI supports device codes; if it does, use this skill's scripts/device_login.py, which will automatically include --accept-disclaimer, generate a link, and wait for authorization. When device code login produces a QR code image address, use scripts/decode_qr.py to decode the browser authorization address, and give the address to the customer as a clickable link; the customer only needs to complete authorization in the Baidu App/browser, and does not need to open a terminal, enter Y , or paste an authorization code. Only older versions fall back to the upstream scripts/login.sh --yes. After login, execute whoami and --json lsin sequence, and check the actual output and exit code; do not write the authorization code, QR code content, or token into the receipt. For the complete gate and failure handling, see login-playbook.md。

2. Read-only operations

python3 <skill-path>/scripts/run_with_env.py -- --json ls
python3 <skill-path>/scripts/run_with_env.py -- --json ls 资料
python3 <skill-path>/scripts/run_with_env.py -- --json search "关键词"
python3 <skill-path>/scripts/run_with_env.py -- whoami

Prefer reading existing scan/index artifacts; only scan the remote when no usable artifacts are available. When the directory does not exist, permissions are insufficient, the exit code is non-zero, or the scan shows LIST_FAIL , do not describe the result as an "empty directory".

3. Remote write operations

First use the wrapper to execute ls --json check the source and target parent directories, then explicitly confirm the exact scope, conflict policy, and whether partial success is allowed. Command names and parameters are subject to the reference documentation of the selected provider. If an upload returns a business JSON error (especially errno=-10), you must stop retrying and read back the target; at the same time, have the customer check the cloud drive capacity and the open platform's upload capability. You cannot infer write permission solely from a successful login.

python3 <skill-path>/scripts/run_with_env.py -- mkdir 资料/新目录
python3 <skill-path>/scripts/run_with_env.py -- mv 资料/旧名 资料/
python3 <skill-path>/scripts/run_with_env.py -- cp 资料/a.pdf 备份/
python3 <skill-path>/scripts/run_with_env.py -- rename 资料/旧名 新名

All write operations must re-list the affected directories or verify the target after execution.share will invoke capabilities that may incur charges, and must be separately flagged and confirmed:

python3 <skill-path>/scripts/run_with_env.py -- share 资料/a.pdf --period 7 --json
python3 <skill-path>/scripts/run_with_env.py -- transfer '<share-url>' -p '<提取码>' --json

4. Upload and Download

python3 <skill-path>/scripts/run_with_env.py -- upload <local-file> 资料/
python3 <skill-path>/scripts/run_with_env.py -- download 资料/a.pdf <local-file>
python3 <skill-path>/scripts/run_with_env.py -- download '<share-url>' <local-dir> -p '<提取码>'

The remote target for a single-file upload must include the file name; a directory upload ends with / . Overwriting, large files, batch tasks, and share transfers must all be confirmed first; after completion, verify local file existence, size, and independently compute a hash if necessary. A terminal timeout does not equal a transfer failure; you should first query the task/target status before deciding whether to retry; an explicit API business error must not be treated as a timeout.

5. Full-Disk Read-Only JSONL Scan

The scanner selects the CLI according to the configuration and only calls the read-only ls --jsonof the corresponding provider, normalizes entries into path、name、id、dir、size、sha1, and preserves md5、mtime:

python3 <skill-path>/scripts/scan_drive.py \
  --root / \
  --out <user-output-dir>/baidupan-scan.jsonl \
  --workers 4 --resume

can be reused with --root /资料 to limit the scope; use --no-descend <目录名> to skip directory recursion; use --resume to skip completed directories via the sidecar. The scan itself does not modify the remote.

At the end, you must check the process exit code, the main JSONL,.errors、.done , and the statistics. If errors exist, deliver a "partial scan," not a "full-disk complete."

Memory Backup and Restore Reminders

The official baidu-drive Skill has built-in memory backup/restore; this is not another Baidu Drive Backup Plugin that must be installed. Only when the current environment is KimiClaw, MaxClaw, QClaw, or OpenClaw should you handle it according to the upstream Skill's capabilities:

  • "Back up memory," "save memory to the cloud drive" → backup。
  • "View memory backups," "backup list" → list。
  • "Restore memory," "revert memory," "restore the backup from 2026-03-16" → restore; you must confirm the date first and cannot default to restoring the latest backup.
  • "Help me remember..." and "organize/clean up memory" are local memory operations and do not trigger cloud drive backup; "back up code/files" is also not a memory backup.
  • Memory operations must call the upstream Skill's own scripts/memory-backup.sh, and must not directly call bdpan upload/download. The local safety-net, manifest, and environment detection before restore are handled by the upstream scripts; this skill does not copy these scripts, nor does it read memory files.
  • If the current environment is not one of the above four, explicitly state that it is not supported and do not execute any backup/restore command.

The upstream script paths are subject to the actually installed baidu-drive Skill; do not replace <skill-path> with this skill's directory.

Boundary with the curator

This skill is only responsible for provider connections, atomic operations, and standardized scan input; it does not copy soia-pkm-alipan-curator 's Alibaba Cloud Drive-specific actions. The two providers can share the JSONL contract consumed by the curator, but the Baidu official CLI, the Alibaba Cloud Drive CLI, and high-risk organization decisions should not be merged into a single trigger. If a Baidu version of the curator is needed in the future, it should reuse the upper-level inventory/catalog/plan approach and inject capabilities through a provider adapter.

Logging and Completion Receipts

Every execution must report:

完成:<一句话说明本次完成了什么>。

日志摘要:
- started: <CLI/版本/登录态检查,不打印秘密值>
- processed: <远端路径或扫描范围;数量如可得>
- created/updated: <数量或用户指定产物>
- skipped/failed: <数量和原因>

文件变化:
- <绝对路径或“未改动文件”>

验证:
- <whoami/ls/本地字节数/扫描 sidecar 等证据>

问题与下一步:
- <缺依赖、待确认事项或建议命令;没有则写“无”>

Verification evidence

  • Static:quick_validate.py skills/soia-pkm-baidu-netdisk-ops、scripts/audit_skills.py、git diff --check。
  • Forward:tests/test_baidupan_scan.py Verified official JSON fields, two-level directory conversion, clean JSONL with a temporary fake CLI,.errors and .done sidecar; configuration loading tests verify provider/binary selection and that secret values are not echoed.
  • Not done: no end-to-end upload, share, or transfer tests using a real Baidu account; real runs still need to follow the official login, user confirmation, and final-state re-verification gates.