优化命令行输出、日志与报错文案,提升终端交互可读性与诊断体验
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "cli-logging-ux" 技能: 1. 下载 https://raw.githubusercontent.com/microsoft/apm/main/.apm/skills/cli-logging-ux/SKILL.md 2. 保存为 ~/.claude/skills/cli-logging-ux/SKILL.md 3. 装好后重载技能,告诉我可以用了
请优化这个 CLI 报错信息,让用户更容易理解原因、影响和下一步操作。保留技术准确性,并给出更清晰的终端输出格式:'Upload failed: invalid config.'
一版更清晰、可执行的错误提示,包含原因说明、修复建议和更友好的终端呈现方式
我在修改命令行工具的日志输出。请为 success、warning、error、info 四类消息制定统一风格规范,包括语气、长度、图标/符号使用、颜色建议和示例文案。
一套适用于命令行日志的文案与视觉规范,便于在不同消息类型中保持一致体验
请帮我设计 CLI 的进度提示和诊断摘要输出,要求让用户快速知道当前阶段、已完成内容、失败项以及下一步建议,并给出示例输出。
结构清晰的进度提示与诊断摘要方案,附带可直接参考的终端输出示例
CLI Logging UX expert persona
Apply these three tests to every piece of user-facing output. If a message fails any test, redesign it.
Every warning must answer: what should the user do about this?
# Fails — not actionable, user can't do anything
Sub-skill 'my-skill' from 'my-package' overwrites existing skill
# Passes — tells the user exactly what to do
Skipping my-skill — local file exists (not managed by APM). Use 'apm install --force' to overwrite.
If the user can't act on it, it's not a warning — it's noise. Demote to --verbose or remove.
Use color semantics consistently. Never use a warning color for an informational state.
| Color | Helper | Meaning | When to use |
|---|---|---|---|
| Green | _rich_success() | Success / completed | Operation finished as expected |
| Yellow |
_rich_warning() |
| User action needed |
| Something requires user decision |
| Red | _rich_error() | Error / failure | Operation failed, cannot continue |
| Blue | _rich_info() | Informational | Status updates, progress, summaries |
| Dim | _rich_echo(color="dim") | Secondary detail | Verbose-mode details, grouping headers |
Can the user scan output like headlines? Top-level = what happened. Details = drill down.
# Bad — warnings break the visual flow between status and summary
[checkmark] package-name
[warning] something happened
[warning] something else happened
[tree] 3 skill(s) integrated
# Good — clean tree, diagnostics at the end
[checkmark] package-name
[tree] 3 skill(s) integrated
── Diagnostics ──
[warning] 2 skills replaced by a different package (last installed wins)
Run with --verbose to see details
_rich_success)_rich_info with indented └─ prefix)_rich_error)# Bad — inline warning repeated per file, clutters output
for file in files:
if collision:
_rich_warning(f"Skipping {file}...")
# Good — collect during loop, render grouped summary at the end
for file in files:
if collision:
diagnostics.skip(file, package=pkg_name)
# Later, after the loop:
if diagnostics.has_diagnostics:
diagnostics.render_summary()
DiagnosticCollector categories: skip() for collisions, overwrite() for cross-package replacements, warn() for general warnings, error() for failures.
Always use the helpers from apm_cli.utils.console — never raw print() or bare click.echo().
Emojis are banned. Never use emoji characters anywhere in CLI output — not in messages, symbols, help text, or status indicators. Use ASCII text symbols exclusively via STATUS_SYMBOLS.
from apm_cli.utils.console import (
_rich_success, _rich_error, _rich_warning, _rich_info, _rich_echo
)
_rich_success("Installed 3 APM dependencies") # green, bold
_rich_info(" └─ 2 prompts integrated → .github/prompts/") # blue
_rich_warning("Config drift detected — re-run apm install") # yellow
_rich_error("Failed to download package") # red
_rich_echo(" [pkg-name]", color="dim") # dim, for verbose details
Use STATUS_SYMBOLS dict with symbol= parameter for consistent ASCII prefixes:
_rich_info("Starting operation...", symbol="gear") # renders as "[*] Starting operation..."
Follow this visual hierarchy for multi-package operations:
…
优化 APM 代码库中的 CLI 输出、日志提示与诊断信息体验
帮助你基于接口文档或脚本快速生成可组合的命令行工具