WelightCLI 指令帮助文档

摘要:集中维护 welight-cli 的命令说明、用途和常见示例。

分类:效率工具

标签:CLI, Node.js

发布时间:2026-04-19T22:59:00

这份文档用于集中维护 welight-cli 的命令说明、用途和常见示例。

如果命令、参数、工作流或推荐用法发生变化,请同步更新本文件。

全局入口

wl

用途:

  • 启动 Welight CLI
  • 首次运行时自动进入 setup 引导

示例:

wl
wl --help
wl --version

Setup

wl setup

用途:

  • 首次初始化 CLI
  • 重新进入配置向导

说明:

  • 会引导配置许可证、AI 文本模型、AI 图片模型、微信公众号信息

示例:

wl setup
wl setup --section license
wl setup --section ai
wl setup --section wechat

Auth

wl auth login

用途:

  • 保存许可证信息并验证当前设备状态

示例:

wl auth login
wl auth login --licenseKey 'YOUR-LICENSE' --customerEmail 'you@example.com'

wl auth status

用途:

  • 查看当前保存的许可证状态

示例:

wl auth status
wl auth status --json

wl auth logout

用途:

  • 清除本地保存的许可证信息

示例:

wl auth logout

Config

wl config path

用途:

  • 查看本地配置目录、配置文件路径和许可证文件路径

示例:

wl config path
wl config path --json

wl config list

用途:

  • 列出当前 CLI 配置
  • 默认会对密钥和密文类字段做脱敏显示

示例:

wl config list
wl config list --show-secrets
wl config list --json

wl config get <key>

用途:

  • 读取单个配置项

示例:

wl config get ai.defaultModel
wl config get wechat.proxyOrigin

wl config set <key> <value>

用途:

  • 写入单个配置项

示例:

wl config set ai.defaultModel glm-46
wl config set wechat.proxyOrigin https://waer.ltd

wl config unset <key>

用途:

  • 删除单个配置项

示例:

wl config unset ai.image.endpoint

wl config export

用途:

  • 导出当前应用配置

示例:

wl config export
wl config export -o ./wl-config.json

wl config import <file>

用途:

  • 从 JSON 文件导入应用配置

示例:

wl config import ./wl-config.json
wl config import ./wl-config.json --merge

Doctor

wl doctor

用途:

  • 检查当前 CLI 环境、配置状态和关键路径

示例:

wl doctor
wl doctor --json
wl doctor --verbose

AI

wl ai create

用途:

  • 基于一个主题或提示词生成公众号文章 Markdown

示例:

wl ai create --prompt "Write a WeChat article about AI workflows"
wl ai create --prompt "Write a product postmortem" --output ./article.md

Article

wl article compose

用途:

  • 走完整的文章创作工作流
  • 支持输入内容、AI 创作或整理、排版、选主题、导出、复制或发布

示例:

wl article compose
wl article compose --input ./article.md
wl article compose --url https://example.com/post
wl article compose --prompt "Write a WeChat article about AI products"

Theme

wl theme list

用途:

  • 查看当前内置主题列表

示例:

wl theme list
wl theme list --json

Cover

wl cover check <file>

用途:

  • 检查文章是否具备可用封面

示例:

wl cover check ./article.html
wl cover check ./article.md --coverImage ./cover.png

wl cover generate

用途:

  • 根据标题和摘要生成封面图

示例:

wl cover generate --title "AI Workflow Trends"
wl cover generate --title "AI Workflow Trends" --summary "A WeChat article about AI workflow changes"

Copy

wl copy wechat <file>

用途:

  • 把公众号兼容内容写入系统剪贴板

示例:

wl copy wechat ./article.html

Publish

wl publish wechat <file>

用途:

  • 把文章推送到公众号草稿箱或正式发布

示例:

wl publish wechat ./article.html --mode draft
wl publish wechat ./article.html --mode publish --coverImage ./cover.png
wl publish wechat ./article.html --mode draft --autoCover

常用配置键

当前支持的主要配置键:

  • ai.defaultModel
  • ai.apiKey
  • ai.image.defaultModel
  • ai.image.apiKey
  • ai.image.endpoint
  • ai.image.defaultSize
  • wechat.appId
  • wechat.appSecret
  • wechat.proxyOrigin

维护约定

  • 新增命令时,必须补充本文件中的用途和示例
  • 命令参数或推荐用法变更时,必须同步更新本文件
  • 发布前如果命令行为有明显变化,也应同步更新 CHANGELOG.md