yuque-cli
语雀通用命令行客户端,以浏览器 cookie 认证,驱动语雀内部 web 接口,提供文档与评论的增删改查。
术语(知识库/文档/评论/space/namespace/slug)见 CONTEXT.md;关键设计取舍见 docs/adr。
安装
需要 Python ≥ 3.10 与 uv。
uv sync # 安装依赖
uv run yuque --help # 项目内运行
uv tool install . # 全局安装
快速开始
yuque auth login # 登录(Playwright 浏览器窗口,优先本地 Chrome,缺失自动下载)
yuque auth status # 查看当前身份
yuque repo list # 列出我的知识库
yuque doc list <space>/<repo> # 列出知识库下的文档
yuque doc get <space>/<repo>/<slug> # 取文档正文(Markdown)
地址可用完整浏览器 URL 或去掉 host 的路径形态,二者等价。
认证
yuque auth login 默认通过 Playwright 打开浏览器窗口完成登录,无需任何浏览器配置(优先复用本地 Chrome,缺失则自动下载 Chromium)。也可通过 --cdp 从已运行浏览器的远程调试端口抓取 cookie,或 --manual 交互式粘贴,或 --cookie "..." 直接传入。
会话保存在 ~/.config/yuque-cli/session.json(权限 0600),yuque auth logout 清除。
全局选项
置于子命令之前:yuque --json repo list。
| 选项 | 说明 |
|---|---|
--json |
输出原始 JSON |
-y, --yes |
跳过确认 |
-v, --verbose |
打印 HTTP 请求到 stderr |
-V, --version |
显示版本 |
命令
auth
| 命令 | 说明 |
|---|---|
auth login [--cdp|--manual|--cookie "..."] |
登录 |
auth status |
显示当前身份 |
auth logout |
清除会话 |
repo
| 命令 | 说明 |
|---|---|
repo list |
列出我的知识库 |
repo get <space>/<repo> |
获取知识库信息 |
repo toc <space>/<repo> |
获取知识库的文档目录树 |
doc
| 命令 | 说明 |
|---|---|
doc list <space>/<repo> |
列出文档 |
doc get <space>/<repo>/<slug> |
取正文(默认 Markdown,--json 出详情) |
doc create <space>/<repo> -t <标题> [选项] |
创建文档 |
doc update <space>/<repo>/<slug> [选项] |
更新文档(先取后合并,未给的字段保持原值) |
doc delete <space>/<repo>/<slug> |
删除文档(软删,可回收站恢复) |
doc create 选项:-t/--title(必填)、--slug、--public/--private、-b/--body、-F/--file。
doc update 选项:-t/--title、--public/--private、-b/--body、-F/--file;至少给其一。
正文中可直接写 @用户名(login 或中文名),CLI 自动搜索用户并转为语雀 @ 提及卡片。
yuque doc create team/handbook -t "上手指南" --body "# 标题\n正文"
yuque doc create team/handbook -t "周报" -F report.md --private
yuque doc create team/handbook -t "评审" --body "@suricatta 请审核这份文档"
yuque doc update team/handbook/getting-started -t "新标题"
yuque -y doc delete team/handbook/old-draft
comment
| 命令 | 说明 |
|---|---|
comment list <space>/<repo>/<slug> |
列出评论 |
comment create <space>/<repo>/<slug> [-b/--body | -F/--file] |
添加评论 |
comment delete <comment_id> |
删除评论 |
review
| 命令 | 说明 |
|---|---|
review create <space>/<repo>/<slug> -r <评审人> [选项] |
创建评审 |
review list <space>/<repo>/<slug> |
获取文档的评审列表 |
review approve <review_id> |
通过评审 |
review unapprove <review_id> |
不通过评审 |
review cancel <review_id> |
取消评审 |
review create 选项:-n/--name(默认「文档评审」)、-d/--description、-r/--reviewer(可多次使用,至少一个)、--cc(可多次使用)。
yuque review create team/handbook/getting-started -r suricatta
yuque review create team/handbook/getting-started -n "技术评审" -r zhangsan -r lisi --cc wangwu
yuque review list team/handbook/getting-started
yuque review approve 12345
正文输入
doc create / comment create 正文来源(--body 与 --file 互斥):
-b/--body内联字符串-F/--file从文件读(-F -读 stdin)- 管道 stdin
echo "# 正文" | yuque doc create team/handbook -t "标题"
doc update 只有显式给 -b/-F 才会改正文,裸管道不生效。
环境变量
| 变量 | 作用 | 默认 |
|---|---|---|
YUQUE_HOST |
目标语雀 host | www.yuque.com |
YUQUE_CONFIG_DIR |
配置目录 | ~/.config/yuque-cli |
NO_COLOR |
禁用彩色输出 | — |
开发
mise run deps # uv sync
mise run test # pytest
mise run lint # ruff check && ruff format
mise run check # pyright
mise run cli -- --help
Metadata
Release files for yuque-cli 3.5.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 |
|---|---|---|---|---|
| yuque_cli-3.5.0.tar.gz | 83.9 kB | Without provenance | Details for yuque_cli-3.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yuque_cli-3.5.0-py3-none-any.whl | Python 3 | none | any | Details for yuque_cli-3.5.0-py3-none-any.whl |
Total release size: 121.2 kB
Release files / yuque_cli-3.5.0.tar.gz
| Download URL | yuque_cli-3.5.0.tar.gz |
|---|---|
| Size | 83.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
57d3e1afaec5e738263cd07dd4e4f9a01e1a1df81fbf6db3b327713c54194684
|
|
BLAKE2b-256 checksum How to use checksums |
2596da7f00a498e30ef3ad9d9d892bc7e0f6416bd5ea07179afbec1901b7064f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / yuque_cli-3.5.0-py3-none-any.whl
| Download URL | yuque_cli-3.5.0-py3-none-any.whl |
|---|---|
| Size | 37.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a634ca05e8cff6986460ba79d3432d3f44a4be58bd6dea19ada1788aaa40e85f
|
|
BLAKE2b-256 checksum How to use checksums |
014fa6e76f4bad97d5535d20de4ba71806efcc386a511339b8c2b66b118dbc05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for yuque-cli 3.5.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.