Halo CLI Shared
Start here when the task says "use Halo CLI" but does not yet say whether it is auth, content, search, operations, or moderation.
Install And Verify
Install globally:
CODEBLOCK0
Binary name:
CODEBLOCK1
Check version and top-level help:
CODEBLOCK2
Top-Level Areas
- - INLINECODE0
- INLINECODE1
- INLINECODE2
- INLINECODE3
- INLINECODE4
- INLINECODE5
- INLINECODE6
- INLINECODE7
- INLINECODE8
- INLINECODE9
- INLINECODE10
Shared Rules
- - Most command areas require an authenticated profile.
- Use
halo auth login to create a profile. - Use
--profile <name> when more than one profile exists. - Use
--json when output is meant for automation or follow-up parsing. - In non-interactive mode, dangerous commands usually require
--force. - Read
--help before guessing flags for a specific command.
Public vs Authenticated
Most areas require auth.
The main public workflow is halo search, which can use a direct site URL without login:
CODEBLOCK3
Config And Secrets
Profile metadata is stored in:
- -
$HALO_CLI_CONFIG_DIR/config.json if HALO_CLI_CONFIG_DIR is set - otherwise INLINECODE19
- otherwise INLINECODE20
Credentials are stored in the system keyring.
Routing
- - Use
halo-cli-auth for login, current profile, profile list/use/delete, and credential repair. - Use
halo-cli-content for posts and single pages. - Use
halo-cli-search for public site search. - Use
halo-cli-operations for themes, plugins, attachments, backups, and moments. - Use
halo-cli-moderation-notifications for comments, replies, and notifications.
Halo CLI 共享
当任务提到使用 Halo CLI但尚未明确是认证、内容、搜索、操作还是审核时,请从这里开始。
安装与验证
全局安装:
bash
npm install -g @halo-dev/cli
二进制名称:
bash
halo
检查版本和顶层帮助:
bash
halo --version
halo --help
顶层领域
- - auth
- post
- single-page
- search
- plugin
- theme
- attachment
- backup
- moment
- comment
- notification
共享规则
- - 大多数命令领域需要已认证的配置文件。
- 使用 halo auth login 创建配置文件。
- 当存在多个配置文件时,使用 --profile <名称>。
- 当输出用于自动化或后续解析时,使用 --json。
- 在非交互模式下,危险命令通常需要 --force。
- 在猜测特定命令的标志之前,请先阅读 --help。
公开与认证
大多数领域需要认证。
主要的公开工作流程是 halo search,它可以直接使用站点 URL 而无需登录:
bash
halo search --keyword halo --url https://www.halo.run
配置与密钥
配置文件元数据存储在:
- - 如果设置了 HALOCLICONFIGDIR,则存储在 $HALOCLICONFIGDIR/config.json
- 否则存储在 $XDGCONFIGHOME/halo/config.json
- 否则存储在 ~/.config/halo/config.json
凭据存储在系统密钥环中。
路由
- - 使用 halo-cli-auth 进行登录、当前配置文件、配置文件列表/使用/删除以及凭据修复。
- 使用 halo-cli-content 处理文章和单页。
- 使用 halo-cli-search 进行公开站点搜索。
- 使用 halo-cli-operations 处理主题、插件、附件、备份和动态。
- 使用 halo-cli-moderation-notifications 处理评论、回复和通知。