cx-cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

cx-cli

cx-cli

Cross-cutting behaviors for all cx CLI commands.

适用于所有cx CLI命令的横切行为。

Update Notifications

更新通知

After running any cx command, check for update notices using the channels below (in priority order). If a newer version is available, finish answering the user's request first, then mention the update once at the end.
An update notice always has two parts — binary upgrade and skills refresh. Offer both commands; don't mention only the version number or only the binary upgrade.
运行任何cx命令后,按以下优先级顺序检查更新通知。如果有新版本可用,请先完成用户请求的答复,再在末尾提及一次更新信息。
更新通知始终包含两部分——二进制文件升级和Skills刷新。需同时提供两个命令;请勿仅提及版本号或仅提及二进制文件升级。

1. Primary — agents mode (
-o agents
)

1. 主渠道——代理模式(
-o agents

Commands with
--output agents
append a standalone trailing JSON line to stdout:
json
{"_meta":{"update":{"binary":{"current":"0.1.7","latest":"0.2.0","command":"brew upgrade cx"},"skills":{"command":"npx skills add coralogix/cx-cli","docs":"https://github.com/coralogix/cx-cli#install"}}}}
Scan the last line of stdout for
_meta.update
. When present:
  • Binary upgrade:
    _meta.update.binary.command
    (current:
    .binary.current
    , latest:
    .binary.latest
    )
  • Skills refresh:
    _meta.update.skills.command
带有
--output agents
的命令会在标准输出(stdout)末尾追加一行独立的JSON:
json
{"_meta":{"update":{"binary":{"current":"0.1.7","latest":"0.2.0","command":"brew upgrade cx"},"skills":{"command":"npx skills add coralogix/cx-cli","docs":"https://github.com/coralogix/cx-cli#install"}}}}
扫描标准输出的最后一行查找
_meta.update
字段。当该字段存在时:
  • 二进制文件升级:
    _meta.update.binary.command
    (当前版本:
    .binary.current
    ,最新版本:
    .binary.latest
  • Skills刷新:
    _meta.update.skills.command

2. Schema startup check

2. Schema启动检查

cx schema
embeds the same
_meta.update
object at the top level of the schema JSON (not a trailing line). Check
_meta.update.binary
and
_meta.update.skills
the same way.
cx schema
会将相同的
_meta.update
对象嵌入到Schema JSON的顶层(而非末尾行)。以同样的方式检查
_meta.update.binary
_meta.update.skills
字段。

3. Fallback — human-readable text

3. 备用渠道——人类可读文本

Also scan stderr and stdout for plain-text notices. Binary and skills appear on one line, separated by
|
:
[cx update] v0.2.0 available (you have 0.1.9) | upgrade: brew upgrade cx | skills: npx skills add coralogix/cx-cli
TTY text mode uses two lines with the same
upgrade: ... | skills: ...
pattern:
cx 0.2.0 is available (you have 0.1.9).
upgrade: brew upgrade cx | skills: npx skills add coralogix/cx-cli
These appear on stderr for text/json mode after normal commands.
同时扫描标准错误输出(stderr)和标准输出(stdout)查找纯文本通知。二进制文件升级和Skills刷新信息在同一行,用
|
分隔:
[cx update] v0.2.0 available (you have 0.1.9) | upgrade: brew upgrade cx | skills: npx skills add coralogix/cx-cli
TTY文本模式使用两行,同样遵循
upgrade: ... | skills: ...
格式:
cx 0.2.0 is available (you have 0.1.9).
upgrade: brew upgrade cx | skills: npx skills add coralogix/cx-cli
这些文本会在普通命令执行后,以文本/JSON模式输出到标准错误流(stderr)。

Response template

回复模板

[Summarize the command result here]

A newer cx version (X.Y.Z) is available — you have A.B.C. Would you like me to run
<binary upgrade command>
and
npx skills add coralogix/cx-cli
to update?
Keep it to one brief closing line. Don't repeat on later commands in the same session.

[在此处总结命令执行结果]

存在更新的cx版本(X.Y.Z)——您当前使用的是A.B.C。是否需要我运行
<二进制升级命令>
npx skills add coralogix/cx-cli
来完成更新?
回复需简洁,仅保留一行收尾内容。在同一会话的后续命令中请勿重复提及。

General cx CLI Guidelines

cx CLI通用指南

  • Always use
    --output agents
    for machine-readable output when processing results programmatically
  • Use
    cx schema
    to discover available commands and their flags
  • Commands support multi-profile fan-out with
    -p profile1 -p profile2
  • Use
    --yes
    to skip confirmation prompts in scripts
  • Use
    --read-only
    for safe exploration without risk of modifications
  • 以编程方式处理结果时,始终使用
    --output agents
    获取机器可读的输出
  • 使用
    cx schema
    探索可用命令及其参数
  • 命令支持通过
    -p profile1 -p profile2
    实现多配置文件扩展
  • 在脚本中使用
    --yes
    跳过确认提示
  • 使用
    --read-only
    进行安全探索,避免产生修改风险