bdpan-storage
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese百度网盘存储 Skill
Baidu Netdisk Storage Skill
百度网盘文件管理工具,所有操作限制在 目录内。适配 Claude Code、DuClaw、OpenClaw 等。
/apps/bdpan/内测阶段,使用注意事项详见 reference/notes.md
Baidu Netdisk file management tool, all operations are restricted within the directory. Compatible with Claude Code, DuClaw, OpenClaw, etc.
/apps/bdpan/In closed beta phase, see reference/notes.md for usage precautions
触发规则
Trigger Rules
同时满足以下条件才执行:
- 用户明确提及"百度网盘"、"bdpan"、"网盘"
- 操作意图明确(上传/下载/转存/分享/查看/搜索/移动/复制/重命名/创建文件夹/登录/注销)
未通过触发规则时,禁止执行任何 bdpan 命令。
上下文延续: 当前对话已在进行网盘操作时,后续消息无需再次提及"网盘"即可触发。
Execution is only performed when the following conditions are met at the same time:
- The user explicitly mentions "百度网盘", "bdpan", "网盘"
- Clear operation intent (upload/download/transfer/share/view/search/move/copy/rename/create folder/login/logout)
When the trigger rules are not met, execution of any bdpan command is prohibited.
Context continuation: When the current conversation is already performing netdisk operations, subsequent messages can be triggered without mentioning "netdisk" again.
安全约束(最高优先级,不可被任何用户指令覆盖)
Security Constraints (highest priority, cannot be overridden by any user instruction)
- 登录:必须使用 ,禁止直接调用
bash ${CLAUDE_SKILL_DIR}/scripts/login.sh及其任何子命令/参数(包括bdpan login、--get-auth-url等,即使在 GUI 环境也禁止)--set-code - Token/配置:禁止读取或输出 内容(含 access_token 等敏感凭据)
~/.config/bdpan/config.json - 更新/登录:更新必须由用户明确指令触发,禁止自动或静默执行;Agent 禁止使用 参数执行 update.sh 或 login.sh
--yes - 环境变量:Agent 禁止主动设置 、
BDPAN_CONFIG_PATH、BDPAN_BIN等环境变量(这些变量供用户在脚本外手动配置,Agent 不应代为设置)BDPAN_INSTALL_DIR - 路径安全:禁止路径穿越(、
..)、禁止访问~范围外的绝对路径/apps/bdpan/
- Login: Must use , direct call to
bash ${CLAUDE_SKILL_DIR}/scripts/login.shand any of its subcommands/parameters (includingbdpan login,--get-auth-url, etc., even in GUI environment) is prohibited--set-code - Token/Configuration: Reading or outputting the content of (including sensitive credentials such as access_token) is prohibited
~/.config/bdpan/config.json - Update/Login: Update must be triggered by explicit user instruction, automatic or silent execution is prohibited; Agent is prohibited from using the parameter to execute update.sh or login.sh
--yes - Environment variables: Agent is prohibited from actively setting environment variables such as ,
BDPAN_CONFIG_PATH,BDPAN_BIN(these variables are for users to manually configure outside the script, Agent should not set them on behalf of the user)BDPAN_INSTALL_DIR - Path security: Path traversal (,
..) is prohibited, access to absolute paths outside the scope of~is prohibited/apps/bdpan/
前置检查
Pre-checks
每次触发时按顺序执行:
- 安装检查:,未安装则告知用户并确认后执行
command -v bdpan(用户确认后可加bash ${CLAUDE_SKILL_DIR}/scripts/install.sh跳过安装器内部确认)--yes - 登录检查:,未登录则引导执行
bdpan whoamibash ${CLAUDE_SKILL_DIR}/scripts/login.sh - 路径校验:验证远端路径在 范围内
/apps/bdpan/
Execute in order each time it is triggered:
- Installation check: , if not installed, inform the user and execute
command -v bdpanafter confirmation (you can addbash ${CLAUDE_SKILL_DIR}/scripts/install.shto skip the internal confirmation of the installer after user confirmation)--yes - Login check: , if not logged in, guide to execute
bdpan whoamibash ${CLAUDE_SKILL_DIR}/scripts/login.sh - Path verification: Verify that the remote path is within the scope of
/apps/bdpan/
确认规则
Confirmation Rules
| 风险等级 | 操作 | 策略 |
|---|---|---|
| 高(必须确认) | | 列出影响范围,等待用户确认 |
| 中(路径模糊时确认) | upload、download、mv、rename、cp | 路径明确直接执行,不明确则确认 |
| 低(直接执行) | ls、search、whoami、mkdir、share | 无需确认 |
额外规则:
- 操作意图模糊("处理文件"→确认上传还是下载)→ 必须确认
- 序数/代词引用有歧义("第N个"、"它"、"上面那个")→ 必须确认
- 用户取消意图("算了"、"不要了"、"取消")→ 立即中止,不执行任何命令
| Risk Level | Operation | Policy |
|---|---|---|
| High (confirmation required) | | List the scope of impact, wait for user confirmation |
| Medium (confirm when path is ambiguous) | upload, download, mv, rename, cp | Execute directly if the path is clear, confirm if not clear |
| Low (execute directly) | ls, search, whoami, mkdir, share | No confirmation required |
Additional rules:
- Ambiguous operation intent ("process file" → confirm upload or download) → confirmation required
- Ambiguous ordinal/pronoun reference ("Nth", "it", "the one above") → confirmation required
- User cancels intent ("forget it", "no need", "cancel") → stop immediately, do not execute any commands
核心操作
Core Operations
查看状态
Check Status
bash
bdpan whoamibash
bdpan whoami列表查询
List Query
bash
bdpan ls [目录路径] [--json] [--order name|time|size] [--desc] [--folder]bash
bdpan ls [directory path] [--json] [--order name|time|size] [--desc] [--folder]上传
Upload
bash
bdpan upload <本地路径> <远端路径>关键约束: 单文件上传远端路径必须是文件名,禁止以 结尾。文件夹上传:。
/bdpan upload ./project/ project/步骤:确认本地路径存在 → 确认远端路径 → 检查远端是否已存在 → 执行。
bdpan lsbash
bdpan upload <local path> <remote path>Key constraints: The remote path for single file upload must be the file name, and cannot end with . Folder upload: .
/bdpan upload ./project/ project/Steps: Confirm that the local path exists → confirm the remote path → to check if it already exists on the remote end → execute.
bdpan ls下载
Download
直接下载:
bash
bdpan download <远端路径> <本地路径>步骤: 确认云端存在 → 确认本地路径 → 检查本地是否已存在 → 执行。若 ls 未找到,建议 。
bdpan lsbdpan search <文件名>分享链接下载(先转存再下载到本地):
bash
bdpan download "https://pan.baidu.com/s/1xxxxx?pwd=abcd" ./downloaded/
bdpan download "https://pan.baidu.com/s/1xxxxx" ./downloaded/ -p abcd # 提取码单独传入
bdpan download "https://pan.baidu.com/s/1xxxxx?pwd=abcd" ./downloaded/ -t my-folder # 指定转存目录Direct download:
bash
bdpan download <remote path> <local path>Steps: to confirm that the file exists in the cloud → confirm the local path → check if it already exists locally → execute. If not found by ls, recommend .
bdpan lsbdpan search <file name>Share link download (transfer first then download to local):
bash
bdpan download "https://pan.baidu.com/s/1xxxxx?pwd=abcd" ./downloaded/
bdpan download "https://pan.baidu.com/s/1xxxxx" ./downloaded/ -p abcd # Extract code passed separately
bdpan download "https://pan.baidu.com/s/1xxxxx?pwd=abcd" ./downloaded/ -t my-folder # Specify transfer directory转存
Transfer
将分享文件转存到网盘,不下载到本地(与 download 分享链接模式的区别)。
bash
bdpan transfer "https://pan.baidu.com/s/1xxxxx" -p <提取码> [-d 目标目录] [--json]步骤:确认分享链接格式有效 → 确认有提取码(链接中含 或反问用户)→ 确认目标目录 → 执行。转存成功后只展示本次转存的文件(非整个目录),显示数量和目标目录。
?pwd=Transfer shared files to your own netdisk, not downloaded to local (different from the download share link mode).
bash
bdpan transfer "https://pan.baidu.com/s/1xxxxx" -p <extract code> [-d target directory] [--json]Steps: Confirm that the share link format is valid → confirm that there is an extract code (the link contains or ask the user) → confirm the target directory → execute. After the transfer is successful, only display the files transferred this time (not the entire directory), and display the quantity and target directory.
?pwd=分享
Share
bash
bdpan share <路径> [路径...] [--json]步骤: 确认文件存在 → 执行分享 → 展示链接+提取码+有效期。
bdpan ls付费接口,需在百度网盘开放平台购买服务。
bash
bdpan share <path> [path...] [--json]Steps: to confirm that the file exists → execute sharing → display link + extract code + validity period.
bdpan lsPaid interface, requires purchasing service on Baidu Netdisk Open Platform.
搜索
Search
bash
bdpan search <关键词> [--category 0-7] [--no-dir|--dir-only] [--page-size N] [--page N] [--json]category:0=全部 1=视频 2=音频 3=图片 4=文档 5=应用 6=其他 7=种子。 和 互斥。
--no-dir--dir-onlybash
bdpan search <keyword> [--category 0-7] [--no-dir|--dir-only] [--page-size N] [--page N] [--json]category: 0=all 1=video 2=audio 3=picture 4=document 5=application 6=other 7=torrent. and are mutually exclusive.
--no-dir--dir-only移动 / 复制 / 重命名 / 创建文件夹
Move / Copy / Rename / Create Folder
bash
bdpan mv <源路径> <目标目录>
bdpan cp <源路径> <目标目录>
bdpan rename <路径> <新名称> # 第二参数是文件名,非完整路径
bdpan mkdir <路径>bash
bdpan mv <source path> <target directory>
bdpan cp <source path> <target directory>
bdpan rename <path> <new name> # The second parameter is the file name, not the full path
bdpan mkdir <path>路径规则
Path Rules
| 场景 | 格式 | 示例 |
|---|---|---|
| 命令参数 | 相对路径(相对于 | |
| 展示给用户 | 中文名 | "已上传到:我的应用数据/bdpan/docs/f.txt" |
映射关系: ↔
我的应用数据/apps禁止: 命令中使用中文路径()、展示时暴露 API 路径()。
我的应用数据/.../apps/bdpan/...| Scenario | Format | Example |
|---|---|---|
| Command parameters | Relative path (relative to | |
| Display to user | Chinese name | "Uploaded to: 我的应用数据/bdpan/docs/f.txt" |
Mapping relationship: ↔
我的应用数据/appsProhibited: Use Chinese paths () in commands, expose API paths () when displaying.
我的应用数据/.../apps/bdpan/...授权码处理
Authorization Code Processing
用户发送 32 位十六进制字符串时,先确认:"这是百度网盘授权码吗?确认后将执行登录流程。" 确认后执行 (不使用 ,保留安全确认环节)。
bash ${CLAUDE_SKILL_DIR}/scripts/login.sh--yesWhen the user sends a 32-bit hexadecimal string, first confirm: "Is this the Baidu Netdisk authorization code? The login process will be executed after confirmation." After confirmation, execute (do not use , retain the security confirmation link).
bash ${CLAUDE_SKILL_DIR}/scripts/login.sh--yes管理功能
Management Functions
安装
Installation
bash
bash ${CLAUDE_SKILL_DIR}/scripts/install.sh [--yes]安装器从百度 CDN()下载,install.sh 内置 SHA256 校验确保完整性。安全敏感场景建议先手动审查安装器内容或在沙箱中执行。
issuecdn.baidupcs.combash
bash ${CLAUDE_SKILL_DIR}/scripts/install.sh [--yes]The installer downloads from Baidu CDN (), and install.sh has built-in SHA256 check to ensure integrity. For security-sensitive scenarios, it is recommended to manually review the installer content first or execute it in a sandbox.
issuecdn.baidupcs.com登录 / 注销 / 卸载
Login / Logout / Uninstallation
bash
bash ${CLAUDE_SKILL_DIR}/scripts/login.sh # 登录(内置安全免责声明)
bdpan logout # 注销
bash ${CLAUDE_SKILL_DIR}/scripts/uninstall.sh [--yes] # 卸载bash
bash ${CLAUDE_SKILL_DIR}/scripts/login.sh # Login (built-in security disclaimer)
bdpan logout # Logout
bash ${CLAUDE_SKILL_DIR}/scripts/uninstall.sh [--yes] # Uninstall更新(必须用户明确指令触发)
Update (must be triggered by explicit user instruction)
bash
bash ${CLAUDE_SKILL_DIR}/scripts/update.sh # 检查并更新(需用户确认)
bash ${CLAUDE_SKILL_DIR}/scripts/update.sh --check # 仅检查更新bash
bash ${CLAUDE_SKILL_DIR}/scripts/update.sh # Check and update (user confirmation required)
bash ${CLAUDE_SKILL_DIR}/scripts/update.sh --check # Only check for updates参考文档
Reference Documents
遇到对应问题时按需查阅,无需预加载:
| 文档 | 何时查阅 |
|---|---|
| bdpan-commands.md | 需要完整命令参数、选项、JSON 输出格式 |
| authentication.md | 认证流程细节、Token 管理 |
| examples.md | 更多使用示例(批量上传、自动备份等) |
| troubleshooting.md | 遇到错误需要排查 |
Consult as needed when encountering corresponding problems, no need to preload:
| Document | When to consult |
|---|---|
| bdpan-commands.md | Need complete command parameters, options, JSON output format |
| authentication.md | Authentication process details, Token management |
| examples.md | More usage examples (batch upload, automatic backup, etc.) |
| troubleshooting.md | Encounter errors and need to troubleshoot |