360 Secure SkillHub
360 安全技能中心

cx-cli

该 Skill 在运行 cx CLI 命令后解析输出中的更新元数据或纯文本提示,按二进制升级、仅技能更新、后台刷新三种情形给出一次性通知;同时汇总通用 cx 用法约定,如输出格式、超时、只读模式及沙箱环境中的凭据存储方式。

分类:自动化
coralogix
热度 53.52
最近更新 2026-12-03 11:24:23

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add coralogix/cx-cli/cx-cli
兼容性
通用兼容
联网要求
需要联网
数据出网
必须出网
Metadata
name
cx-cli
description
This skill should be used whenever the user runs any cx command, uses the cx CLI, Coralogix CLI, or mentions cx in the context of Coralogix observability. This skill provides cross-cutting concerns like update notifications that apply to all cx commands.
metadata
{"version":"0.3.1"}

cx-cli

Cross-cutting behaviors for all cx CLI commands.


Update Notifications

After running any cx command, check for update notices using the channels below (in priority order). If an update is available, finish answering the user's request first, then mention the update once at the end.

There are three kinds of notice:

  • Binary update — a newer cx version exists. The notice has two parts: the binary upgrade and the skills refresh. Offer both commands, binary first.
  • Skills-only update — cx itself is on the newest version, but the installed agent skills are older than it (typical right after brew upgrade cx), or cx can't tell which version they are. Offer only the skills refresh command.
  • Skills refreshing — the installed skills are older than cx (or cx can't tell their version), and cx is now refreshing them itself in the background (reason: "refreshing"). No action is needed: say once that the cx skills are being updated and take effect in a new agent session. Don't offer a command.

1. Primary — toon mode (-o toon)

Commands with --output toon append a standalone trailing JSON line to stdout. Binary update:

{"_meta":{"update":{"binary":{"current":"0.1.7","latest":"0.2.0","command":"brew upgrade cx"},"skills":{"command":"cx skills install --global","docs":"https://github.com/coralogix/cx-cli#install"}}}}

Skills-only update (no binary key). reason is "outdated" (cx installed the skills for an older version), "unknown_version" (cx did not install them, so it can't tell their version), or "refreshing" (cx started the refresh itself; no action needed). installed_for is the cx version the skills were installed for, or null when unknown:

{"_meta":{"update":{"skills":{"command":"cx skills install --global","docs":"https://github.com/coralogix/cx-cli#install","reason":"outdated","installed_for":"0.1.20"}}}}

Scan the last line of stdout for _meta.update. When present:

  • Binary upgrade (only if _meta.update.binary exists): .binary.command (current: .binary.current, latest: .binary.latest)
  • Skills refresh: _meta.update.skills.command

2. Schema startup check

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.

3. Fallback — human-readable text

Also scan stderr and stdout for plain-text notices. A binary update shows binary and skills on one line, separated by |:

[cx update] v0.2.0 available (you have 0.1.9) | upgrade: brew upgrade cx | skills: cx skills install --global

A skills-only update, for outdated or unknown-version skills:

[cx update] cx agent skills are older than cx 0.1.9 | skills: cx skills install --global
[cx update] cx can't tell which version your cx agent skills are | skills: cx skills install --global

Skills refreshing (no command, nothing to run):

[cx update] refreshing cx agent skills for cx 0.1.9 in the background

TTY text mode uses two lines; for a binary or skills-only update the second line names the skills command after skills::

cx 0.2.0 is available (you have 0.1.9).
upgrade: brew upgrade cx | skills: cx skills install --global

These appear on stderr for text/json mode after normal commands.

Response template

Binary update:

[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 then <skills command> to update?

Skills-only update:

[Summarize the command result here]


Your cx agent skills may be older than your cx version, so some commands may be missing from them. Would you like me to run <skills command> to update them?

Skills refreshing:

[Summarize the command result here]


cx is updating its agent skills in the background. The new skills apply in a new agent session.

Keep it to one brief closing line. Don't repeat on later commands in the same session.


General cx CLI Guidelines

  • Always use --output toon 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, or --label <label> to fan out across every profile tagged with that label (cx profiles list shows labels; cx profiles labels add <name> --label <label> tags one)
  • For commands that query or manage Coralogix data, use --http-timeout <SECONDS> or CX_HTTP_TIMEOUT=<SECONDS> to set an API request deadline.
  • Use --yes to skip confirmation prompts in scripts
  • Use --read-only for safe exploration without risk of modifications

Credential Storage in Agent Sandboxes

When configuring a profile from a macOS sandbox, credentials must stay in the profile file. Coding-agent sandboxes usually make Keychain read-only: stored credentials can be read, but saving one can open a Keychain dialog that nobody can answer. Current cx versions detect read-only and denied Keychain access and choose file storage automatically. Always prefix profile setup commands with the override anyway; it also covers older cx versions:

CX_CREDENTIAL_STORAGE=file cx profiles add ...

Never attempt to access or approve a macOS Keychain prompt from an agent sandbox. When cx reports that a Keychain-backed profile cannot be used in the sandbox, ask the user to run cx profiles refresh <name> outside the sandbox (for an expired OAuth session), to reconfigure the profile outside the sandbox with file storage, or to provide an API key through CX_API_KEY before continuing; the variable does not read the Keychain secret automatically. CX_API_KEY applies when cx selects the default profile. For an explicit --profile or --label, cx intentionally ignores the environment override, so pass it explicitly:

cx --profile <name> --api-key "$CX_API_KEY" ...

Do not use a single API-key override with multiple --profile or --label targets; cx rejects that ambiguous combination. Each selected profile must use file-backed credentials instead.

cx profiles refresh cannot use an API-key override. For a Keychain-backed profile, run refresh outside the sandbox or reconfigure it with file storage outside the sandbox.

Do not modify or reconfigure an existing profile from the sandbox when that profile stores credentials in Keychain. File-backed profiles and new profiles are safe: cx selects file storage when the macOS sandbox blocks Keychain or makes it read-only.