> ## Documentation Index
> Fetch the complete documentation index at: https://adminroletesting-justin-client-exports.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 本地预览

> 使用 mint dev 运行 Mintlify 文档站点的本地预览，支持实时重载、全文搜索和 AI 助手。

<div id="prerequisites">
  ## 前提条件
</div>

* 已全局安装 [Mintlify CLI](/zh/cli/install)，或使用 `npx mint` 运行命令。
* 包含有效 `docs.json` 文件的文档目录。

<div id="start-the-local-preview">
  ## 启动本地预览
</div>

导航到包含 `docs.json` 文件的文档目录，然后运行：

```bash theme={null}
mint dev
```

本地预览在 `http://localhost:3000` 启动。编辑时，更改会实时显示。

默认情况下，预览会自动在浏览器中打开。要阻止浏览器打开，请使用 `--no-open` 选项：

```bash theme={null}
mint dev --no-open
```

要在不全局安装 CLI 的情况下生成预览，请运行：

```bash theme={null}
npx mint dev
```

<div id="log-in-for-search-and-assistant">
  ## 登录以启用搜索和助手
</div>

你需要使用 Mintlify 账户对 CLI 进行身份验证，才能启用搜索和 [AI 助手](/zh/assistant/index)。

```bash theme={null}
mint login
```

使用 `mint login` 命令完成身份验证后，CLI 会将你的凭据存储在 `~/.config/mintlify/config.json` 中，以便你在各会话之间保持登录状态。CLI 还会提示你选择一个默认项目，`mint automations` 等命令会使用该项目。

登录后，运行 `mint dev` 启动带有搜索和助手功能的本地预览。助手使用与已部署文档站点相同的索引内容。

要检查你的身份验证状态，请运行：

```bash theme={null}
mint status
```

要注销，请运行：

```bash theme={null}
mint logout
```

<div id="custom-ports">
  ## 自定义端口
</div>

默认情况下，CLI 使用端口 3000。要使用不同的端口，请使用 `--port` 选项：

```bash theme={null}
mint dev --port 3333
```

如果端口已被占用，CLI 会自动尝试下一个可用端口。

<div id="skip-openapi-processing">
  ## 跳过 OpenAPI 处理
</div>

如果你有大量 OpenAPI 文件，可以在本地开发时使用 `--disable-openapi` 选项跳过 OpenAPI 处理以提高性能：

```bash theme={null}
mint dev --disable-openapi
```

<div id="preview-as-a-specific-group">
  ## 以特定组预览
</div>

如果你使用基于组的访问控制，可以使用 `--groups` 选项以特定身份验证组进行预览：

```bash theme={null}
mint dev --groups admin
```

有关组的更多信息，请参阅[身份验证设置](/zh/deploy/authentication-setup#control-access-with-groups)。
