> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dropcv.work/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI 命令行

> 通过 @dropcv/cli 命令行工具，在终端、脚本、CI/CD 中调用 DropCV 能力。

`dropcv` 是 DropCV 的官方命令行工具，把人才库搜索、简历导入、JD 匹配、skill 调用等能力封装成可直接执行的命令。

## 适用场景

* 批量导入历史简历（一条命令搞定）
* 写 shell 脚本定时同步数据
* 在 CI/CD 流水线中触发候选人评估
* 不想写 HTTP 请求、只想要"能跑"的接入方式

## 安装

需要 Node.js 20 或更高版本。

```bash theme={null}
npm install -g @dropcv/cli
```

安装后即可使用 `dropcv` 命令。验证：

```bash theme={null}
dropcv --help
```

<Note>
  当前为 alpha 版本（`0.1.0-alpha.x`）。`npm install -g @dropcv/cli` 默认装最新版；升级同样执行这条命令即可。
</Note>

## 登录

CLI 用 [API Key](/integration/skills/authentication) 鉴权。先在 [设置 → API Keys](https://app.dropcv.work/dashboard/settings/api-keys) 生成 key，再登录：

```bash theme={null}
# 交互式：按提示粘贴 API Key
dropcv login

# 非交互式：直接传 key（适合 CI）
dropcv login --key drop_cv_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

凭据保存在 `~/.config/dropcv/config.json`（文件权限 `0600`）。默认 API 地址为 `https://api.dropcv.work`，可用 `--api-url` 覆盖。

| 命令              | 说明                    |
| --------------- | --------------------- |
| `dropcv whoami` | 查看当前登录状态，并校验 key 是否有效 |
| `dropcv logout` | 清除本地凭据                |

## 简历导入

`import resume` 把 PDF 简历上传入库。

```bash theme={null}
# 导入单个 PDF 简历
dropcv import resume ./候选人张三.pdf

# 批量导入目录下所有简历
dropcv import resume ./resumes/ --recursive

# 导入时标注来源 URL
dropcv import resume ./resume.pdf --source-url https://www.zhipin.com/...
```

| 选项                   | 说明                       |
| -------------------- | ------------------------ |
| `-r, --recursive`    | 把 `<path>` 当作目录，导入其中所有简历 |
| `--source-url <url>` | 为导入的候选人标注来源 URL          |

<Note>
  仅支持能提取出文本的 PDF 文件；扫描件 / 纯图片 PDF 和 TXT 会被跳过并说明原因。
</Note>

## 人才库查询

```bash theme={null}
# 搜索候选人（关键词或 JD 片段）
dropcv candidates search "3 年 React 经验，有大厂背景"

# 限制返回数量（1-50，默认 10）
dropcv candidates search "Python 后端" --top-k 5

# 查看候选人完整档案
dropcv candidates get <candidate-id>
```

加 `--json` 输出原始 JSON envelope，方便脚本处理。

## JD 解析与匹配

```bash theme={null}
# 解析 JD 为结构化字段
dropcv jd parse ./jd.txt

# 从标准输入解析
cat jd.txt | dropcv jd parse -

# 用 JD 匹配人才库
dropcv match jd ./jd.txt --top-k 15
```

`jd parse` 和 `match jd` 的 `<file>` 参数都支持传 `-` 从标准输入读取。

## 通用 skill 调用

`skill` 命令直接访问 [Skills API](/integration/skills/overview) 的全部能力。

```bash theme={null}
# 列出所有可用 skill
dropcv skill list

# 查看某个 skill 的元数据和入参 schema
dropcv skill describe candidate_search

# 调用任意 skill —— 用 --params 传 JSON
dropcv skill invoke candidate_search --params '{"query":"Python 后端","top_k":5}'

# 从文件读取参数
dropcv skill invoke candidate_search --params-file ./params.json

# 简写：key 后面跟 字段 值 成对传参
dropcv skill invoke jd_parse jd_text "高级前端工程师，要求 3 年以上 React 经验..."
```

## 下一步

<CardGroup cols={2}>
  <Card title="Skills API" icon="code" href="/integration/skills/overview">
    了解 CLI 背后调用的能力体系。
  </Card>

  <Card title="MCP Server" icon="plug" href="/integration/mcp">
    在 AI 工具里用自然语言操作人才库。
  </Card>
</CardGroup>
