一个用于管理 Halo 实例的命令行工具。
npm install -g @halo-dev/cli安装后可执行命令为:
halo查看版本:
halo --version- Node.js
>= 22
halo auth login \
--profile local \
--url http://127.0.0.1:8090 \
--auth-type bearer \
--token <your-token>在使用 Basic Auth 之前,请先确保你的 Halo 实例已启用 Basic Auth。
启动 Halo 时增加以下参数:
--halo.security.basic-auth.disabled=false然后执行登录:
halo auth login \
--profile local \
--url http://127.0.0.1:8090 \
--auth-type basic \
--username admin \
--password <your-password>halo auth current
halo auth profile list查看帮助:
halo --help
halo auth --help
halo post --help
halo single-page --help根命令帮助输出示例:
halo/1.0.0
Usage:
$ halo <command> [options]
Commands:
auth Authentication commands
post Post management commands
single-page Single page management commands
search Search public site content
plugin Plugin management commands
theme Theme management commands
attachment Attachment management commands
backup Backup management commands
moment Moment management commands
comment Comment management commands
notification Notification management commands
For more info, run any command with the `--help` flag:
$ halo auth --help
$ halo post --help
$ halo single-page --help
$ halo search --help
$ halo plugin --help
$ halo theme --help
$ halo attachment --help
$ halo backup --help
$ halo moment --help
$ halo comment --help
$ halo notification --help
Options:
-h, --help Display this message
-v, --version Display version number
指定已保存的 profile:
halo post list --profile production使用 JSON 输出以便脚本处理:
halo post list --json
halo single-page get about --json启用终端补全:
对于 bash:
eval "$(halo completion bash)"对于 zsh:
eval "$(halo completion zsh)"启用后,可以通过 Tab 补全这类命令:
halo <TAB>
halo auth <TAB>
halo comment reply <TAB>当前 Halo CLI 包含以下命令分组:
authpostsingle-pagesearchpluginthemeattachmentbackupmomentcommentnotification
更多细节请使用 --help 查看。
此包还附带了可复用的 skills,位于根目录下的 skills/。
包含的 skills:
halo-clihalo-cli-sharedhalo-cli-authhalo-cli-contenthalo-cli-searchhalo-cli-operationshalo-cli-moderation-notifications
可以通过下面的方式添加 skills:
npx skills add halo-dev/cli安装后,推荐先从这里开始:
skills/halo-cli/SKILL.mdprofile 元数据存储在:
- 如果设置了
HALO_CLI_CONFIG_DIR,则为$HALO_CLI_CONFIG_DIR/config.json - 否则为
$XDG_CONFIG_HOME/halo/config.json - 再否则为
~/.config/halo/config.json
凭据会存储在系统 keyring 中。
常用命令:
pnpm typecheck
vp lint
vp test
vp pack发布前建议先检查打包内容:
npm pack --dry-run通过命令执行版本发布流程,但不发布到 npm:
vp run release
vp run release:dry这里使用 release-it 来更新版本号、生成 release commit、创建 git tag、推送到远端,并创建 GitHub Release。
不会发布到 npm。
发布包中应包含:
dist/skills/README.mdREADME.zh-CN.mdLICENSE
MIT