---
title: 命令参考
description: Welight CLI 全部命令与常用参数：渲染、排版、复制、发布、检查与配置。
---

CLI 的命令分为「创作」「质量」「发布」「配置」几类。所有命令都支持 `--help`，例如 `wl render --help`。

## 命令总览

| 命令 | 说明 |
| --- | --- |
| `wl render <file>` | 选主题渲染为 HTML，自动写文件并在浏览器打开 |
| `wl layout <file>` | 一键排版：按档位用 AI 重排文章结构 |
| `wl copy <file>` | 生成公众号内联 HTML 并写入系统剪贴板 |
| `wl publish <file>` | 直连微信创建公众号草稿 |
| `wl lint <file>` | 公众号平台规则扫描 |
| `wl checkup <file>` | 文章体检（12 项量化检查） |
| `wl detect <file>` | 腾讯朱雀 AIGC 检测 |
| `wl title [file]` | 生成候选标题（可选评分排序） |
| `wl ai [prompt]` | Welight AI 单轮指令 |
| `wl chat` | Welight AI 多轮对话 |
| `wl setup` | 配置向导 |
| `wl model` | 配置模型（提供商 / 模型 / 密钥） |
| `wl auth` | 管理本地凭据（密钥） |
| `wl config` | 查看或修改配置 |
| `wl themes` | 列出可用的免费主题 |
| `wl doctor` | 检查运行环境、配置与密钥状态 |
| `wl init` | 生成 `welight.config.json` 配置模板 |
| `wl completion` | 输出 shell 补全脚本 |

文件参数传 `-` 表示从 stdin 读取。

## 创作

### `wl render`

选主题渲染为带主题样式的 HTML。终端下的默认行为是**选主题 → 写文件 → 在浏览器打开预览**：

```bash
wl render post.md
wl render post.md --theme w011 --out out.html
wl render post.md --stdout > out.html      # 输出原始 HTML（管道 / 脚本）
```

- `-t, --theme <name>`：主题名，省略时会列出可用主题供选择
- `-o, --out <path>`：输出路径，默认与源文件同名 `.html`
- `--stdout`：输出 HTML 到标准输出，不写文件、不打开浏览器
- `--no-open`：生成文件后不自动打开浏览器

### `wl layout`

一键排版：用 AI 重新组织标题层级、强调与列表，保留原文事实与代码。

```bash
wl layout post.md --in-place
wl layout post.md --tier auto --out post-formatted.md
```

- `-t, --tier <tier>`：`auto | minimal | standard | rich`（默认 `minimal`）；`auto` 由判断层按内容推荐
- `--in-place`：直接覆盖源文件
- `-o, --out <path>`：写入新文件
- `--json`：以 JSON 输出
- 其余可选：`--model`、`--base-url`、`--api-key`、`--typesafe-key`

### `wl copy`

生成公众号内联 HTML 并写入系统剪贴板，到公众号后台编辑器直接粘贴：

```bash
wl copy post.md --theme w011
```

- `--code-theme <name>`：highlight.js 代码高亮主题，`none` 关闭

### `wl title`

为文章生成候选标题，配置了判断层密钥时可自动评分排序：

```bash
wl title post.md --count 6
wl title --topic "如何用 Markdown 排版公众号"
```

- `--topic <text>`：直接给定主题
- `--count <n>`：生成数量，默认 5
- `--score` / `--no-score`：是否用判断层评分
- `--json`：结构化输出

## 质量检查

### `wl lint`

使用内置规则库离线扫描文章命中的公众号平台规则。命中是**风险线索而非违规结论**。

```bash
wl lint post.md
wl lint post.md --fail-on high --json
```

- `--fail-on <level>`：`none | low | medium | high`，命中达到该级别时退出码为 1
- `--json`：完整扫描报告

### `wl checkup`

对文章做 12 项量化体检：开头吸引力、结构、过渡、长段落、重复、术语、表格 / 图表机会、可读性、收尾、互动引导与标题一致性。需要判断层密钥。

```bash
wl checkup post.md
wl checkup post.md --fail-on action
```

### `wl detect`

调用腾讯朱雀做 AIGC 检测，输出人工 / AI 生成 / 疑似 AI 占比。需要自配 EdgeOne Key。

```bash
wl detect post.md
wl detect post.md --max-ai 40      # AI + 疑似占比达到 40% 时退出码为 1
```

## 发布

### `wl publish`

渲染并直连微信接口创建**公众号草稿**（不做正式发布）。

```bash
wl publish post.md --cover ./cover.png --preview
```

- `--cover <path>`：封面图路径或 URL，省略时取正文首图
- `--title` / `--author` / `--digest` / `--source-url`：草稿信息
- `--open-comment` / `--fans-comment-only`：评论设置
- `--watermark` / `--no-watermark`：是否追加文末水印
- `--preview`：创建后轮询草稿预览链接
- `--proxy <origin>`：自建微信 API 反向代理（默认直连）

:::caution
默认直连 `api.weixin.qq.com`，需要先把当前出口 IP 加入公众号后台「开发 → 基本配置 → IP 白名单」，否则会返回 `40164`。详见[自动化与集成](/cli/automation)。
:::

## 配置

```bash
wl setup                       # 配置向导
wl model --provider deepseek   # 配置模型
wl auth list                   # 查看凭据状态
wl config set theme w011       # 修改配置
wl doctor                      # 环境自检
```

这些命令的细节见[配置与密钥](/cli/configuration)。
