介绍
# Nudocs
将文档上传至 Nudocs.ai 进行富文本编辑,获取可分享链接,并拉取结果。
## 安装
1. 安装 CLI: ```bash npm install -g @nutrient-sdk/nudocs-cli ```
2. 从 https://nudocs.ai 获取 API 密钥(登录后点击“Integration”)
3. 配置密钥: ```bash # Option 1: Environment variable export NUDOCS_API_KEY="nudocs_your_key_here"
# Option 2: Config file mkdir -p ~/.config/nudocs echo "nudocs_your_key_here" > ~/.config/nudocs/api_key ```
## 命令
```bash nudocs upload <file> # Upload and get edit link nudocs list # List all documents nudocs link [ulid] # Get edit link (last upload if no ULID) nudocs pull [ulid] [--format fmt] # Download document (default: docx) nudocs delete <ulid> # Delete a document nudocs config # Show configuration ```
## 工作流
### 上传流程 1. 创建/编写文档内容 2. 保存为 Markdown(或其他支持的格式) 3. 运行:`nudocs upload <file>` 4. 将返回的编辑链接分享给用户
### 拉取流程 1. 用户请求取回文档 2. 运行:`nudocs pull [ulid] --format <fmt>` 3. 阅读并展示下载的文件
### 格式选择
| 场景 | 推荐格式 | |----------|-------------------| | 用户进行了富文本格式编辑 | `docx`(默认) | | 简单的文本/代码内容 | `md` | | 最终交付/分享 | `pdf` |
有关完整的格式支持,请参阅 `references/formats.md`。
## 自然语言触发词
识别以下用户意图:
**上传/发送:** - "send to nudocs" - "upload to nudocs" - "open in nudocs" - "edit this in nudocs" - "let me edit this in nudocs" - "put this in nudocs"
**拉取/获取:** - "pull it back" - "pull from nudocs" - "get that doc" - "fetch from nudocs" - "download from nudocs" - "grab the updated version" - "what did I change" - "get my edits"
**链接:** - "get the nudocs link" - "share link" - "where's that doc" - "nudocs url"
**列表:** - "show my nudocs" - "list my documents" - "what docs do I have" - "my nudocs documents"
## 文档最佳实践
上传前,请确保结构良好: - 清晰的标题层级(H1 → H2 → H3) - 一致的间距 - 适当的列表格式 - 简洁的段落(3-5 句话)
有关模板和指南,请参阅 `references/document-design.md`。
## 示例会话
``` User: Write me a blog post about remote work and send it to Nudocs
Agent: 1. Writes blog-remote-work.md with proper structure 2. Runs: nudocs upload blog-remote-work.md 3. Returns: "Here's your Nudocs link: https://nudocs.ai/file/01ABC..."
User: *edits in Nudocs, adds formatting, images* User: Pull that back
Agent: 1. Runs: nudocs pull --format docx 2. Reads the downloaded file 3. Returns: "Got your updated document! Here's what changed..." ```
## 错误处理
| 错误 | 原因 | 解决方案 | |-------|-------|----------| | "No API key found" | 缺少凭证 | 设置 NUDOCS_API_KEY 或创建配置文件 | | "DOCUMENT_LIMIT_REACHED" | 免费版限制(10 个文档) | 删除旧文档或升级至 Pro | | "Unauthorized" | API 密钥无效 | 在 Nudocs 设置中重新生成密钥 | | "No ULID provided" | 缺少文档 ID | 指定 ULID 或先上传文档 |
## 链接
- CLI: https://github.com/PSPDFKit/nudocs-cli(npm 上的 `@nutrient-sdk/nudocs-cli`) - MCP Server: https://github.com/PSPDFKit/nudocs-mcp-server - Nudocs: https://nudocs.ai