dev-cli-consistency-audit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCLI Consistency Review
CLI工具一致性审查
Systematic review of a CLI tool's command interface to ensure consistent naming, conventions, and documentation alignment.
对CLI工具的命令界面进行系统性审查,确保命名、约定和文档的一致性。
Workflow
工作流程
Step 1: Inventory Commands
步骤1:梳理命令清单
- Run the CLI with or
--helpto get the top-level command list-h - For each subcommand, run to get its full interface
<cmd> <subcmd> --help - Build an inventory table:
| Command | Positional Args | Flags | Output Formats |
|---------------|------------------|--------------------|----------------|
| pull | owner/repo | --issues, --prs | table, json |
| search | [query] | --type, --limit | fzf |
| prune | owner/repo | --confirm, --dry-run| table |- 运行CLI工具的或
--help命令获取顶层命令列表-h - 对于每个子命令,运行以获取其完整界面
<cmd> <subcmd> --help - 构建清单表格:
| Command | Positional Args | Flags | Output Formats |
|---------------|------------------|--------------------|----------------|
| pull | owner/repo | --issues, --prs | table, json |
| search | [query] | --type, --limit | fzf |
| prune | owner/repo | --confirm, --dry-run| table |Step 2: Convention Analysis
步骤2:约定分析
Check for consistency across all commands:
-
Positional vs Flag arguments:
- Is the same concept (e.g., ) passed as positional in some commands and as
owner/repoflag in others?--repo - Recommendation: Pick one approach and apply everywhere
- Is the same concept (e.g.,
-
Flag naming:
- Are similar concepts named consistently? (e.g., vs
--outputvs--format)-o - Do boolean flags follow the same pattern? (vs
--dry-runvs--confirm)--yes - Are shorthand flags (,
-f) assigned consistently?-o
- Are similar concepts named consistently? (e.g.,
-
Pluralization:
- Subcommand names: singular vs plural (e.g., vs
list files)list file - Flag names: vs
--issue--issues
- Subcommand names: singular vs plural (e.g.,
-
Default behaviors:
- Are defaults consistent? (e.g., if one command defaults to , do others?)
--format=table - Are destructive commands safe by default? (require or
--confirm)--force
- Are defaults consistent? (e.g., if one command defaults to
-
Error messages:
- Do error messages follow a consistent format?
- Are they actionable (tell the user what to do)?
检查所有命令的一致性:
-
位置参数与标志参数:
- 同一个概念(如)在某些命令中作为位置参数,而在其他命令中作为
owner/repo标志传递?--repo - 建议:选择一种方式并全局应用
- 同一个概念(如
-
标志命名:
- 相似概念的命名是否一致?(例如vs
--outputvs--format)-o - 布尔标志是否遵循相同模式?(vs
--dry-runvs--confirm)--yes - 简写标志(,
-f)的分配是否一致?-o
- 相似概念的命名是否一致?(例如
-
单复数形式:
- 子命令名称:单数 vs 复数(例如vs
list files)list file - 标志名称:vs
--issue--issues
- 子命令名称:单数 vs 复数(例如
-
默认行为:
- 默认设置是否一致?(例如,如果某个命令默认使用,其他命令是否也如此?)
--format=table - 破坏性命令默认是否安全?(是否需要或
--confirm确认)--force
- 默认设置是否一致?(例如,如果某个命令默认使用
-
错误消息:
- 错误消息是否遵循统一格式?
- 是否具备可操作性(告知用户应采取的措施)?
Step 3: Documentation Alignment
步骤3:文档对齐检查
-
Compare the README documentation with actualoutput:
--help- Are all commands documented?
- Do the documented flags match the actual implementation?
- Are examples up to date and runnable?
-
Check help text quality:
- Does each command have a one-line description?
- Are flag descriptions clear and consistent in style?
- Do examples in text work?
--help
-
比较README文档与实际输出:
--help- 所有命令是否都有文档说明?
- 文档中记录的标志是否与实际实现一致?
- 示例是否是最新且可运行的?
-
检查帮助文本质量:
- 每个命令是否有一行简短描述?
- 标志描述是否清晰且风格一致?
- 文本中的示例是否可用?
--help
Step 4: Report
步骤4:生成审查报告
Present findings:
CLI Consistency Review:
Inconsistencies Found:
1. [Issue] — [Commands affected] — [Suggested fix]
2. ...
Documentation Gaps:
1. [What's missing] — [Where]
2. ...
Recommendations:
1. [Convention to adopt] — [Rationale]
2. ...呈现审查结果:
CLI Consistency Review:
Inconsistencies Found:
1. [Issue] — [Commands affected] — [Suggested fix]
2. ...
Documentation Gaps:
1. [What's missing] — [Where]
2. ...
Recommendations:
1. [Convention to adopt] — [Rationale]
2. ...Step 5: Apply Fixes
步骤5:应用修复
For each accepted fix:
- Update the command implementation (flag names, defaults, etc.)
- Update help text and descriptions
- Update README to match
- Run again to verify alignment
--help
对于每个已确认的修复项:
- 更新命令实现(标志名称、默认设置等)
- 更新帮助文本和描述
- 更新README文档以保持一致
- 再次运行验证对齐情况
--help
Best Practices Reference
最佳实践参考
- Positional arguments: Use for the primary subject (e.g., ). Limit to 1-2 positional args.
owner/repo - Flags: Use for modifiers and options. Always provide ; add
--long-formshorthand only for frequently used flags.-s - Boolean flags: Use to enable (default off). For "default on" behaviors, use
--flagto disable.--no-flag - Output format: If supporting multiple formats, use consistently.
--format=table|json|yaml - Destructive operations: Default to dry-run or require explicit .
--confirm - Verbosity: Use /
--verboseconsistently. Consider-v/--quietas well.-q
- 位置参数:用于主要操作对象(如)。限制为1-2个位置参数。
owner/repo - 标志:用于修饰符和选项。始终提供长格式;仅为高频使用的标志添加
--long-form简写形式。-s - 布尔标志:使用启用(默认关闭)。对于“默认开启”的行为,使用
--flag来禁用。--no-flag - 输出格式:如果支持多种格式,统一使用。
--format=table|json|yaml - 破坏性操作:默认设置为试运行(dry-run)或要求显式的确认。
--confirm - 详细程度:统一使用/
--verbose。也可考虑添加-v/--quiet。-q
Examples
示例
Example 1: Full CLI review
User: "review our cli arguments and make sure they are aligned"
Action:
1. Run --help for all commands
2. Build inventory table
3. Identify naming inconsistencies
4. Check README alignment
5. Present report with specific fixesExample 2: Pre-release check
User: "make sure our command implementation and comments are aligned"
Action:
1. Compare help text with actual behavior
2. Verify README examples work
3. Check for undocumented flags
4. Update docs to match implementation示例1:完整CLI审查
User: "review our cli arguments and make sure they are aligned"
Action:
1. Run --help for all commands
2. Build inventory table
3. Identify naming inconsistencies
4. Check README alignment
5. Present report with specific fixes示例2:发布前检查
User: "make sure our command implementation and comments are aligned"
Action:
1. Compare help text with actual behavior
2. Verify README examples work
3. Check for undocumented flags
4. Update docs to match implementation