orchata-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOrchata CLI Commands
Orchata CLI 命令
Use this skill when you need to run commands in a terminal/shell environment.
orchataUse when:
- You need to run shell commands in a terminal
- You need to perform batch file uploads
- You're working with file system operations
- You need to script or automate Orchata operations
- You want JSON output for parsing
Don't use when:
- You have MCP tools available (use skill instead)
orchata-mcp - You need tree-based document navigation (MCP only feature)
- You need programmatic function calls (use skill instead)
orchata-mcp
当你需要在终端/Shell环境中运行命令时,请使用此技能。
orchata适用场景:
- 需要在终端中运行Shell命令
- 需要执行批量文件上传
- 进行文件系统操作
- 需要编写脚本或自动化Orchata操作
- 需要JSON格式的输出用于解析
不适用场景:
- 可使用MCP工具时(请改用技能)
orchata-mcp - 需要基于树状结构的文档导航(仅MCP支持的功能)
- 需要程序化函数调用时(请改用技能)
orchata-mcp
What is Orchata?
什么是Orchata?
Orchata is a knowledge management platform that:
- Organizes documents into Spaces - Logical containers for related content
- Provides semantic search - Find relevant content using natural language queries
- Provides CLI - Terminal interface for document management and queries
Orchata是一款知识管理平台,具备以下特性:
- 将文档组织到空间中 - 相关内容的逻辑容器
- 提供语义搜索 - 使用自然语言查询查找相关内容
- 提供CLI工具 - 用于文档管理和查询的终端界面
Installation & Setup
安装与设置
Installation
安装
bash
undefinedbash
undefinedInstall globally via npm
通过npm全局安装
npm install -g @orchata/cli
npm install -g @orchata/cli
Or via bun
或通过bun安装
bun add -g @orchata/cli
bun add -g @orchata/cli
Or via pnpm
或通过pnpm安装
pnpm add -g @orchata/cli
pnpm add -g @orchata/cli
Or via yarn
或通过yarn安装
yarn global add @orchata/cli
yarn global add @orchata/cli
Verify installation
验证安装
orchata --version
undefinedorchata --version
undefinedInitial Configuration
初始配置
bash
undefinedbash
undefined1. Configure CLI (run once after install)
1. 配置CLI(安装后运行一次)
orchata init
orchata init
2. Authenticate with your API key
2. 使用API密钥进行身份验证
orchata login
orchata login
3. Verify connection
3. 验证连接
orchata spaces list
undefinedorchata spaces list
undefinedEnvironment Variables
环境变量
bash
undefinedbash
undefinedOptional: Override settings via environment variables
可选:通过环境变量覆盖设置
export ORCHATA_API_KEY="oai_..."
export ORCHATA_API_BASE="https://api.orchata.ai"
export ORCHATA_PROFILE="production"
---export ORCHATA_API_KEY="oai_..."
export ORCHATA_API_BASE="https://api.orchata.ai"
export ORCHATA_PROFILE="production"
---CLI Commands Reference
CLI命令参考
Space Management
空间管理
List all spaces
列出所有空间
bash
orchata spaces listbash
orchata spaces listCreate a space
创建空间
bash
orchata spaces create --name "Product Docs" --description "Technical documentation" --icon bookOptions:
- - Space name (required)
--name <name> - - Space description (optional)
--description <text> - - Icon:
--icon <icon>,folder,book,file-text,database,package,archive,briefcase,inbox,layersbox
bash
orchata spaces create --name "产品文档" --description "技术文档" --icon book选项:
- - 空间名称(必填)
--name <name> - - 空间描述(可选)
--description <text> - - 图标选项:
--icon <icon>,folder,book,file-text,database,package,archive,briefcase,inbox,layersbox
Get a specific space
获取指定空间信息
bash
orchata spaces get space_abc123bash
orchata spaces get space_abc123Update a space
更新空间
bash
orchata spaces update space_abc123 --name "Updated Name" --description "New description"bash
orchata spaces update space_abc123 --name "更新后的名称" --description "新描述"Delete a space (soft delete/archive)
删除空间(软删除/归档)
bash
orchata spaces delete space_abc123bash
orchata spaces delete space_abc123Document Management
文档管理
List documents in a space
列出空间中的文档
bash
orchata documents list --space space_abc123bash
orchata documents list --space space_abc123Upload a file
上传文件
bash
orchata documents upload ./path/to/file.pdf --space space_abc123
orchata documents upload ./guide.md --space space_abc123bash
orchata documents upload ./path/to/file.pdf --space space_abc123
orchata documents upload ./guide.md --space space_abc123Upload inline content
上传内嵌内容
bash
orchata documents upload --space space_abc123 --content "# Title\n\nContent here..."bash
orchata documents upload --space space_abc123 --content "# 标题\n\n内容..."Batch upload (directory)
批量上传(目录)
bash
orchata documents batch ./docs/ --space space_abc123This is the most powerful CLI feature - upload entire directories in one command!
bash
orchata documents batch ./docs/ --space space_abc123这是CLI最强大的功能 - 一键上传整个目录的内容!
Get a document
获取文档信息
bash
orchata documents get doc_xyz789 --space space_abc123bash
orchata documents get doc_xyz789 --space space_abc123Get document content (processed text)
获取文档内容(处理后的文本)
bash
orchata documents content doc_xyz789 --space space_abc123bash
orchata documents content doc_xyz789 --space space_abc123Append to a document
追加内容到文档
bash
orchata documents append doc_xyz789 --space space_abc123 --content "Additional content..."bash
orchata documents append doc_xyz789 --space space_abc123 --content "额外内容..."Querying
查询功能
Query a specific space
查询指定空间
bash
orchata query "How do I authenticate?" --space space_abc123bash
orchata query "如何进行身份验证?" --space space_abc123Query with more results
查询更多结果
bash
orchata query "installation guide" --space space_abc123 --top-k 15Options:
- - Space ID to query (required for basic query)
--space <id> - - Maximum number of results (default: 10)
--top-k <n>
bash
orchata query "安装指南" --space space_abc123 --top-k 15选项:
- - 要查询的空间ID(基础查询必填)
--space <id> - - 最大结果数量(默认:10)
--top-k <n>
Smart query (discover relevant spaces)
智能查询(发现相关空间)
bash
orchata query smart "what is orchata"This helps you find which spaces are relevant when you don't know where to look.
bash
orchata query smart "什么是Orchata"当你不知道该查询哪个空间时,此功能可帮助你找到相关的空间。
Global Options
全局选项
These options work with any command:
bash
orchata spaces list --profile production
orchata query "test" --space space_123 --api-key oai_custom_key --jsonAvailable global options:
- - Use a named profile
--profile <name> - - Override API base URL
--api-base <url> - - Override app base URL
--app-base <url> - - Override API key for this run
--api-key <key> - - Output raw JSON (useful for scripting)
--json
这些选项适用于所有命令:
bash
orchata spaces list --profile production
orchata query "测试" --space space_123 --api-key oai_custom_key --json可用全局选项:
- - 使用指定名称的配置文件
--profile <name> - - 覆盖API基础URL
--api-base <url> - - 覆盖应用基础URL
--app-base <url> - - 本次运行使用自定义API密钥
--api-key <key> - - 输出原始JSON(适用于脚本编写)
--json
Common Patterns
常见使用模式
Pattern 1: Upload files and query them
模式1:上传文件并查询
bash
undefinedbash
undefined1. Create a space
1. 创建空间
orchata spaces create --name "Docs" --description "Product documentation"
orchata spaces create --name "文档" --description "产品文档"
Returns: space_abc123
返回:space_abc123
2. Upload documents
2. 上传文档
orchata documents upload ./handbook.pdf --space space_abc123
orchata documents upload ./api-guide.md --space space_abc123
orchata documents upload ./handbook.pdf --space space_abc123
orchata documents upload ./api-guide.md --space space_abc123
3. Wait ~1-3 seconds for processing, then query
3. 等待约1-3秒处理完成,然后查询
orchata query "authentication flow" --space space_abc123
undefinedorchata query "认证流程" --space space_abc123
undefinedPattern 2: Batch upload directory
模式2:批量上传目录
bash
undefinedbash
undefinedUpload all files in a directory
上传目录中的所有文件
orchata documents batch ./documentation/ --space space_abc123
**This is ideal for:**
- Initial knowledge base setup
- Bulk document imports
- Directory synchronizationorchata documents batch ./documentation/ --space space_abc123
**此功能非常适合:**
- 知识库初始搭建
- 批量文档导入
- 目录同步Pattern 3: Discover and search
模式3:发现与搜索
bash
undefinedbash
undefined1. Find relevant spaces
1. 查找相关空间
orchata query smart "billing questions"
orchata query smart "计费问题"
Returns: space_billing (most relevant)
返回:space_billing(最相关)
2. Query that space
2. 查询该空间
orchata query "payment methods" --space space_billing
undefinedorchata query "支付方式" --space space_billing
undefinedPattern 4: Get raw JSON for scripting
模式4:获取原始JSON用于脚本
bash
undefinedbash
undefinedGet JSON output for parsing
获取可解析的JSON输出
orchata spaces list --json | jq '.spaces[] | .id'
orchata query "test" --space space_123 --json | jq '.results[0].content'
**Use JSON mode for:**
- Shell scripts
- CI/CD pipelines
- Automation workflows
- Data processingorchata spaces list --json | jq '.spaces[] | .id'
orchata query "测试" --space space_123 --json | jq '.results[0].content'
**JSON模式适用于:**
- Shell脚本
- CI/CD流水线
- 自动化工作流
- 数据处理Pattern 5: Profile management for multiple environments
模式5:多环境配置文件管理
bash
undefinedbash
undefinedLogin to different environments
登录到不同环境
orchata login --profile development
orchata login --profile production
orchata login --profile development
orchata login --profile production
Use specific profile
使用指定配置文件
orchata query "test" --space space_123 --profile production
---orchata query "测试" --space space_123 --profile production
---Document Processing
文档处理
Documents are processed asynchronously:
- Upload returns immediately with
status="PROCESSING" - Background job generates embeddings and indexes the document (typically 1-3 seconds)
- Status changes to when ready
"COMPLETED" - Document becomes searchable
To check completion status:
bash
undefined文档为异步处理:
- 上传后立即返回
status="PROCESSING" - 后台任务生成嵌入向量并索引文档(通常需要1-3秒)
- 处理完成后状态变为
"COMPLETED" - 文档可被搜索
检查处理完成状态:
bash
undefinedList all documents with their status
列出所有文档及其状态
orchata documents list --space space_abc123
orchata documents list --space space_abc123
Check specific document
检查指定文档
orchata documents get doc_xyz789 --space space_abc123
**Supported file formats:**
- PDF (text-based and scanned with OCR)
- Word documents (.docx)
- Excel spreadsheets (.xlsx)
- PowerPoint presentations (.pptx)
- Markdown files (.md)
- Plain text files (.txt)
- Images (PNG, JPG, etc.)
---orchata documents get doc_xyz789 --space space_abc123
**支持的文件格式:**
- PDF(基于文本和带OCR的扫描件)
- Word文档(.docx)
- Excel表格(.xlsx)
- PowerPoint演示文稿(.pptx)
- Markdown文件(.md)
- 纯文本文件(.txt)
- 图片(PNG、JPG等)
---Best Practices
最佳实践
DO
建议
- Use batch upload for directories - is efficient
orchata documents batch - Use flag for scripting - Easy to parse programmatically
--json - Wait 1-3 seconds after upload - Give documents time to process
- Use descriptive space names and descriptions - Helps with discovery
- Check document status before querying - Only COMPLETED documents are searchable
- Use profiles for multiple environments - dev, staging, production
- 使用批量上传功能处理目录 - 效率更高
orchata documents batch - 编写脚本时使用标志 - 便于程序化解析
--json - 上传后等待1-3秒 - 给文档留出处理时间
- 使用描述性的空间名称和描述 - 有助于空间发现
- 查询前检查文档状态 - 仅状态为COMPLETED的文档可被搜索
- 使用配置文件管理多环境 - 开发、 staging、生产环境
DON'T
不建议
- Don't query immediately after upload - Wait for processing to complete
- Don't use very short queries - More context = better results
- Don't forget to authenticate - Run first
orchata login - Don't mix profile credentials - Use flag consistently
--profile
- 上传后立即查询 - 等待处理完成后再查询
- 使用过短的查询语句 - 上下文越详细,结果越准确
- 忘记身份验证 - 先运行
orchata login - 混合配置文件凭据 - 始终使用标志区分
--profile
Troubleshooting
故障排除
"Command not found: orchata"
"Command not found: orchata"
Solution:
bash
npm install -g @orchata/cli
orchata --versionVerify the CLI is installed and in your PATH.
解决方案:
bash
npm install -g @orchata/cli
orchata --version验证CLI已安装且在PATH中。
"Authentication required"
"Authentication required"
Solution:
bash
orchata login解决方案:
bash
orchata loginOr set environment variable:
或设置环境变量:
export ORCHATA_API_KEY="oai_..."
undefinedexport ORCHATA_API_KEY="oai_..."
undefined"Space not found"
"Space not found"
Solution:
bash
orchata spaces list解决方案:
bash
orchata spaces listUse the exact space ID from the list
使用列表中的准确空间ID
undefinedundefined"Document still processing"
"Document still processing"
Solution:
Wait 1-3 seconds after upload for processing to complete:
bash
orchata documents list --space <space_id>解决方案:
上传后等待1-3秒,待处理完成:
bash
orchata documents list --space <space_id>Check status field
查看status字段
undefinedundefinedUpload fails
上传失败
Common causes:
- File is too large (check file size limits)
- Invalid file format (check supported formats above)
- Space is archived (use a different space)
- Network issues (check connection)
常见原因:
- 文件过大(检查文件大小限制)
- 文件格式无效(检查上述支持的格式)
- 空间已归档(使用其他空间)
- 网络问题(检查连接)
Configuration Files
配置文件
The CLI stores configuration in :
~/.orchata/config.jsonjson
{
"profiles": {
"default": {
"apiKey": "oai_...",
"apiBase": "https://api.orchata.ai",
"appBase": "https://app.orchata.ai"
},
"production": {
"apiKey": "oai_...",
"apiBase": "https://api.orchata.ai"
}
},
"defaultProfile": "default"
}You can also manage configuration with:
bash
orchata configure --api-base https://api.orchata.ai
orchata configure --profile production --set-defaultCLI将配置存储在中:
~/.orchata/config.jsonjson
{
"profiles": {
"default": {
"apiKey": "oai_...",
"apiBase": "https://api.orchata.ai",
"appBase": "https://app.orchata.ai"
},
"production": {
"apiKey": "oai_...",
"apiBase": "https://api.orchata.ai"
}
},
"defaultProfile": "default"
}你也可以通过以下命令管理配置:
bash
orchata configure --api-base https://api.orchata.ai
orchata configure --profile production --set-defaultQuick Reference
速查表
| Task | Command |
|---|---|
| List spaces | |
| Create space | |
| Get space | |
| List documents | |
| Upload file | |
| Batch upload | |
| Get document | |
| Search content | |
| Discover spaces | |
| JSON output | |
| 任务 | 命令 |
|---|---|
| 列出空间 | |
| 创建空间 | |
| 获取空间信息 | |
| 列出文档 | |
| 上传文件 | |
| 批量上传 | |
| 获取文档信息 | |
| 搜索内容 | |
| 发现空间 | |
| JSON输出 | |
Script Examples
脚本示例
Bash: Upload and wait for processing
Bash:上传并等待处理完成
bash
#!/bin/bash
SPACE_ID="space_abc123"
FILE="./document.pdf"bash
#!/bin/bash
SPACE_ID="space_abc123"
FILE="./document.pdf"Upload
上传
echo "Uploading ${FILE}..."
RESULT=$(orchata documents upload "${FILE}" --space "${SPACE_ID}" --json)
DOC_ID=$(echo $RESULT | jq -r '.document.id')
echo "Document ID: ${DOC_ID}"
echo "Waiting for processing..."
echo "正在上传${FILE}..."
RESULT=$(orchata documents upload "${FILE}" --space "${SPACE_ID}" --json)
DOC_ID=$(echo $RESULT | jq -r '.document.id')
echo "文档ID:${DOC_ID}"
echo "等待处理完成..."
Wait for completion
等待处理完成
while true; do
STATUS=$(orchata documents get "${DOC_ID}" --space "${SPACE_ID}" --json | jq -r '.document.status')
if [ "$STATUS" = "COMPLETED" ]; then
echo "Processing complete!"
break
elif [ "$STATUS" = "FAILED" ]; then
echo "Processing failed!"
exit 1
fi
echo "Status: ${STATUS}..."
sleep 2
done
while true; do
STATUS=$(orchata documents get "${DOC_ID}" --space "${SPACE_ID}" --json | jq -r '.document.status')
if [ "$STATUS" = "COMPLETED" ]; then
echo "处理完成!"
break
elif [ "$STATUS" = "FAILED" ]; then
echo "处理失败!"
exit 1
fi
echo "状态:${STATUS}..."
sleep 2
done
Query
查询
orchata query "summary of document" --space "${SPACE_ID}"
undefinedorchata query "文档摘要" --space "${SPACE_ID}"
undefinedPython: Batch upload with status checking
Python:批量上传并检查状态
python
import subprocess
import json
import time
def run_orchata(command):
"""Run orchata CLI command and return JSON result"""
cmd = f"orchata {command} --json"
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
return json.loads(result.stdout)python
import subprocess
import json
import time
def run_orchata(command):
"""运行Orchata CLI命令并返回JSON结果"""
cmd = f"orchata {command} --json"
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
return json.loads(result.stdout)Create space
创建空间
space = run_orchata('spaces create --name "My Docs"')
space_id = space['space']['id']
space = run_orchata('spaces create --name "我的文档"')
space_id = space['space']['id']
Batch upload
批量上传
print(f"Uploading to space: {space_id}")
run_orchata(f'documents batch ./docs/ --space {space_id}')
print(f"正在上传到空间:{space_id}")
run_orchata(f'documents batch ./docs/ --space {space_id}')
Wait for all documents to process
等待所有文档处理完成
print("Waiting for processing...")
while True:
docs = run_orchata(f'documents list --space {space_id}')
pending = [d for d in docs['documents'] if d['status'] != 'COMPLETED']
if not pending:
print("All documents processed!")
break
print(f"{len(pending)} documents still processing...")
time.sleep(3)print("等待处理完成...")
while True:
docs = run_orchata(f'documents list --space {space_id}')
pending = [d for d in docs['documents'] if d['status'] != 'COMPLETED']
if not pending:
print("所有文档处理完成!")
break
print(f"仍有{len(pending)}个文档在处理中...")
time.sleep(3)Query
查询
results = run_orchata(f'query "main topics" --space {space_id}')
print(json.dumps(results, indent=2))
---results = run_orchata(f'query "主要主题" --space {space_id}')
print(json.dumps(results, indent=2))
---Differences from MCP Tools
与MCP工具的差异
CLI does NOT support:
- ❌ Tree-based document navigation (,
get_document_tree)get_tree_node - ❌ Direct document updates (use upload with same filename to replace)
- ❌ Compact query format (always returns full results)
CLI excels at:
- ✅ Batch file operations ()
orchata documents batch - ✅ Scripting and automation
- ✅ JSON output for parsing
- ✅ Profile management for multiple environments
- ✅ File system integration
For tree-based navigation and programmatic access, use the skill instead.
orchata-mcpCLI不支持:
- ❌ 基于树状结构的文档导航(,
get_document_tree)get_tree_node - ❌ 直接更新文档(使用相同文件名上传来替换)
- ❌ 紧凑查询格式(始终返回完整结果)
CLI擅长:
- ✅ 批量文件操作()
orchata documents batch - ✅ 脚本编写与自动化
- ✅ 可解析的JSON输出
- ✅ 多环境配置文件管理
- ✅ 文件系统集成
如需树状导航和程序化访问,请改用技能。
orchata-mcp