优化 APM 代码库中的 CLI 输出、日志提示与诊断信息体验
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "cli-logging-ux" 技能: 1. 下载 https://raw.githubusercontent.com/microsoft/apm/main/.agents/skills/cli-logging-ux/SKILL.md 2. 保存为 ~/.claude/skills/cli-logging-ux/SKILL.md 3. 装好后重载技能,告诉我可以用了
请优化这段 APM CLI 的报错输出:保留技术细节,但让用户更快理解问题、影响和下一步操作。请给出更清晰的错误文案、建议的退出码说明,以及适合 _rich_error 的输出格式。
一版更清晰、可执行的错误提示文案,包含原因、影响和修复建议。
请检查这组 CLI 日志与状态提示,统一成功、警告、信息和进度消息的语气、结构与符号使用;如果涉及 STATUS_SYMBOLS、CommandLogger 或 _rich_success/_rich_warning/_rich_info,请给出具体改写建议。
一套风格统一的日志与状态文案规范,以及对应的逐条改写建议。
请为 DiagnosticCollector 生成的诊断摘要做 UX 优化:按严重级别分组,突出关键信号,减少噪音,并让终端输出更适合快速排障。请给出建议的摘要结构和示例文案。
一个更易扫读的诊断摘要结构,附带终端友好的示例输出文案。
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 的命令交互、帮助文案与首次使用体验