bdpan-cli
百度网盘工程化 CLI 管理工具。基于百度网盘开放平台官方 SDK 与协议标准构建,提供文件管理、分片上传续传、冲突副本治理与影视媒体库规范化自动化刮削整理。
快速安装 (Installation)
方式 1:uv tool 安装(推荐,隔离环境)
uv tool install bdpan-cli
方式 2:即用即走(无需预先安装)
uvx bdpan-cli --help
方式 3:传统 pip 安装
pip install bdpan-cli
方式 4:跨平台单文件二进制(免 Python 运行时)
前往 GitHub Releases 直接下载对应平台单文件二进制可执行包,加入 PATH 即可运行:
bdpan-linux-amd64bdpan-linux-arm64bdpan-macos-arm64(Apple Silicon)bdpan-macos-x86_64(Intel)bdpan-windows-amd64.exe
命令行使用 (CLI)
# 查看帮助
bdpan --help
# 常用命令
bdpan ls /影视/电影
bdpan mkdir /新目录
bdpan mv <源路径>... <目标目录> # 多源时目标须为已存在目录(自动记录流水)
bdpan cp <源路径>... <目标目录|目标目录/新名> # 单源支持改名
bdpan rename <路径> <新名称> # 原地更名(自动记录流水)
bdpan rm <路径>... [-y]
bdpan quota [--check-expire] [--check-free] # 网盘容量
bdpan whoami # 账户信息
bdpan search <关键词> [--dir 目录] [--no-recursion]
bdpan tree <路径> [--depth N] [--index 索引.json] # 递归树+本地索引
bdpan upload <本地文件> <目标目录|目标目录/新名> [--overwrite] # 分片上传+断点续传(首片秒传+动态机房)
bdpan download <网盘文件>... [--dest 本地目录] [--overwrite] # 大文件断点续传下载
bdpan dlink <网盘文件>... [--aria2 | --curl] # 提取高速直链或导出下载脚本
bdpan dedup /影视/电影 --staging-dir /隔离区 # 治理 (1)/(2) 冲突副本
bdpan scrape foldering /影视/电影/unscraped # 媒体库电影散落文件建目录归集(默认方案 A,支持 --format 模板)
bdpan scrape preview /影视/电影/待刮削 # 刮削重命名预演(支持 --format 模板,生成对照表)
bdpan scrape apply preview.csv # 批量应用刮削重命名
# 安全运维体系与操作撤销 (Safety & Undo)
bdpan ops list [--limit 20] # 查看关键变更操作流水审计日志
bdpan ops show <op_id> # 查看某次操作的明细与映射清单
bdpan undo <op_id> [--dry-run] [-y] # 逆向撤销回滚指定批次操作(支持预演)
# 多账号认证与隔离 (Multi-Account Auth)
bdpan auth list # 查看本地保存的网盘账号及凭证有效性
bdpan auth switch <alias> # 切换当前默认活跃账号
bdpan auth login [--account <alias>] # 登录/重新授权指定账号别名
bdpan --account <alias> <subcommand> # 临时以指定账号执行单次命令(多租户并发隔离)
# 媒体可观测性与全局选项 (Media Insights & Global Options)
bdpan info /影视/电影/Inception.mkv # 探测视频精准分辨率(4K/1080P)、时长、HEVC编码与音轨
bdpan stats /影视/电影 [--depth N] # 递归聚合统计目录总容量、总文件数及媒体格式分类占比
bdpan -V / --version # 查看当前 CLI 工具版本号
bdpan --json <subcommand> # 所有核心查询命令支持标准化 JSON 信封输出(脚本化集成)
bdpan --debug <subcommand> # 开启详细诊断调试日志(输出至 stderr,双写至 ~/.config/bdpan/logs/)
bdpan -q <subcommand> # 静音非错误输出(仅保留 ERROR)
# AI 原生集成 (Model Context Protocol / MCP)
bdpan mcp # 启动标准 stdio MCP Server,供 Claude Code / Cursor / AI 智能体调用
操作安全机制:
mv/cp遵循严格目标判定;rm默认交互确认,-y跳过;网盘删除由服务端移入回收站。批量操作支持--dry-run预演;所有破坏性移动更名自动落盘流水审计,支持一键逆向回滚还原。
本地开发环境
# 克隆仓库
git clone https://github.com/CodingRookie98/bdpan-cli.git
cd bdpan-cli
# 安装依赖
uv sync
# 本地调试运行
uv run bdpan --help
# 运行全量测试
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run pytest
应用凭证与用户数据
- 开发者应用密钥:复制模板并填入开放平台应用的 AppKey / AppSecret(
.env已被 git 忽略,不会提交):
cp .env.example .env
- 用户登录授权凭据:用户首次通过 OAuth 登录授权后,Token 自动保存在
~/.config/bdpan/tokens.json(受系统权限0o600保护)。 - 诊断调试日志:完整执行细节自动落盘双写至
~/.config/bdpan/logs/bdpan.log。
项目结构
├── docs/ # 治理文档(Diátaxis 四象限,见 docs/GOVERNANCE.md)
│ ├── index.md # 知识库总入口
│ ├── llms.txt # AI 智能体机器地图
│ ├── project/ # 演进路线图 (roadmap.md)、待办 (backlog.md)、计划 (plans/)
│ └── reference/api/ # SDK 接口参考(机器真理源)
├── pyproject.toml # 标准 Python 项目配置与 CLI 命令行入口
├── src/bdpan_cli/ # 核心业务代码与 CLI 子命令
│ └── _vendor/ # 内聚内嵌的 OpenAPI Client 依赖包(标准轮子直接打包)
├── tests/ # 单元测试与回归套件 (180+ 项全绿)
└── .python-version # 3.12
贡献与开源
详细贡献规范、测试门禁与提交信息格式见 CONTRIBUTING.md。开源许可协议遵循 MIT License。
Metadata
Release files for bdpan-cli 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bdpan_cli-0.1.0.tar.gz | 106.6 kB | With provenance | Details for bdpan_cli-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bdpan_cli-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for bdpan_cli-0.1.0-py3-none-any.whl |
Total release size: 244.6 kB
Release files / bdpan_cli-0.1.0.tar.gz
| Download URL | bdpan_cli-0.1.0.tar.gz |
|---|---|
| Size | 106.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d9466e00922613fa344a10749c5cc2fc439b451ae762118e968b914eec3659a3
|
|
BLAKE2b-256 checksum How to use checksums |
54c2f8338d76db817cb67328699e6fd4652dabacd96c1921cb21dc250edf5e82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logRelease files / bdpan_cli-0.1.0-py3-none-any.whl
| Download URL | bdpan_cli-0.1.0-py3-none-any.whl |
|---|---|
| Size | 138.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8ed807110a42b538f088eb31323daee61c45945096e81025e7b9ec22b6cbeb49
|
|
BLAKE2b-256 checksum How to use checksums |
75faac42072318d067a093ab6a12dabc2fddf6a347a0c61e3416e8ea8fdfd34a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logSecurity for bdpan-cli 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for bdpan_cli-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.