用途
Paperless 技能用于通过 ppls 命令行工具与 Paperless-NGX 文档管理系统进行交互,实现文档的搜索、检索、上传和整理。它适合需要以自动化或 AI 方式批量操作 Paperless-NGX 文档的场景。
主要能力
- 搜索文档:支持按名称、日期范围、标签(OR/AND/排除)、通信方、文档类型、缺失元数据、最近添加或修改等条件筛选,并可组合多个过滤条件。
- 查看与下载:可获取文档完整详情(包含 OCR 内容),下载单个或多个文档,也可下载原始(预处理前)版本。
- 上传文档:支持简单上传(由 Paperless 自动处理),也可在上传时指定标题、通信方、文档类型和标签等元数据。
- 管理元数据:可列出、创建标签、通信方和文档类型,并更新文档的元数据。
使用方式
安装与配置
npm install -g @nickchristensen/ppls
ppls config set hostname http://your-paperless-host
ppls config set token your-api-token
搜索文档
# 按名称
ppls documents list --name-contains "invoice" --json
# 按日期范围
ppls documents list --created-after 2024-01-01 --created-before 2024-12-31 --json
# 按标签(OR — 任意一个标签)
ppls documents list --tag 5 --tag 12 --json
# 按标签(AND — 必须包含所有)
ppls documents list --tag-all 5,12 --json
# 排除标签
ppls documents list --tag-not 3 --json
# 按通信方
ppls documents list --correspondent 7 --json
# 按文档类型
ppls documents list --document-type 2 --json
# 缺少元数据的文档
ppls documents list --no-correspondent --json
ppls documents list --no-tag --json
# 最近添加/修改
ppls documents list --added-after 2024-06-01 --json
ppls documents list --modified-after 2024-06-01 --json
# 组合过滤
ppls documents list --correspondent 7 --created-after 2024-01-01 --tag 5 --json
查看与下载
# 获取文档完整详情(包含 OCR 内容)
ppls documents show 1234 --json
# 下载单个文档
ppls documents download 1234 --output ~/Downloads/doc.pdf
# 下载多个文档
ppls documents download 1234 5678 --output-dir ~/Downloads
# 下载原始(预处理前)版本
ppls documents download 1234 --original
上传文档
# 简单上传(Paperless 自动处理)
ppls documents add scan.pdf
# 带元数据上传
ppls documents add receipt.pdf \
--title "Store Receipt" \
--correspondent 5 \
--document-type 2 \
--tag 10
管理元数据
# 列出标签/通信方/文档类型
ppls tags list --json
ppls correspondents list --json
ppls document-types list --json
# 创建新项
ppls tags add "Tax 2024" --color "#ff0000"
ppls correspondents add "New Vendor"
ppls document-types add "Contract"
# 更新文档元数据
ppls documents update 1234 --title "New Title" --correspondent 5 --tag 10
适用场景
- 需要以脚本或 AI 方式批量搜索、筛选 Paperless-NGX 中的文档。
- 需要自动化下载或上传文档,并附带或更新元数据。
- 需要管理标签、通信方和文档类型等分类信息。
限制与提示
- 始终使用
--json以获得最易解析的输出,适合 AI/自动化。 - 日期格式为
YYYY-MM-DD或完整 ISO 8601。 - ID 为数字,可使用
list --json命令查找。 - 过滤器可重复:
--tag 1 --tag 2或--tag 1,2均可。 - 分页:使用
--page和--page-size处理大量结果。 - 其他功能、收费、价格、平台或效果信息暂未提供。