inquirerer-anti-patterns

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

CLI Anti-Patterns: Avoid These Libraries

CLI反模式:避免使用以下库

This skill defines what NOT to do when building CLI tools in Constructive projects. All CLI development should use
inquirerer
instead of other CLI libraries.
本skill定义了在Constructive项目中构建CLI工具时的禁止行为。所有CLI开发都应使用
inquirerer
而非其他CLI库。

When to Apply

适用场景

Apply this skill when:
  • Reviewing code that imports commander, inquirer.js, yargs, or similar
  • Someone asks about using a CLI library other than inquirerer
  • Creating a new CLI tool and considering which library to use
在以下场景应用本skill:
  • 审核导入了commander、inquirer.js、yargs或同类库的代码时
  • 有人询问是否可以使用inquirerer以外的CLI库时
  • 新建CLI工具正在选型依赖库时

Forbidden Libraries

禁止使用的库

Do NOT use these libraries in Constructive projects:
LibraryReason to Avoid
commander
Separate argument parsing, no integrated prompts
inquirer
/
inquirer.js
Outdated, not TypeScript-first, different API
yargs
Complex API, no integrated prompts
prompts
Limited features, no resolver system
enquirer
Different API, no Constructive integration
vorpal
Unmaintained, complex
oclif
Heavyweight framework, overkill for most uses
meow
Minimal, no prompt support
arg
Argument parsing only
minimist
(directly)
Use inquirerer's
parseArgv
wrapper instead
ora
Use inquirerer's
createSpinner
instead
cli-progress
Use inquirerer's
createProgress
instead
在Constructive项目中请勿使用以下库:
库名禁用原因
commander
仅提供独立参数解析功能,无集成提示能力
inquirer
/
inquirer.js
版本过时,非TypeScript优先设计,API与标准不统一
yargs
API设计复杂,无集成提示能力
prompts
功能有限,无解析器系统
enquirer
API不统一,无Constructive生态集成
vorpal
不再维护,设计复杂
oclif
重量级框架,绝大多数场景下属于过度使用
meow
功能极简,不支持提示功能
arg
仅支持参数解析
minimist
(直接使用)
请改用inquirerer封装的
parseArgv
方法
ora
请改用inquirerer的
createSpinner
方法
cli-progress
请改用inquirerer的
createProgress
方法

Why inquirerer is the Standard

为什么inquirerer是标准选择

inquirerer is the standard CLI library for all Constructive monorepos because it provides a unified approach across all our projects:
  1. Consistency: All Constructive CLIs have the same look, feel, and behavior
  2. TypeScript-first: Full type safety for questions and answers
  3. Integrated: Single library for argument parsing, prompts, and UI components
  4. Dynamic defaults: Built-in resolvers for git config, npm, dates, workspace info
  5. CI/CD ready: Non-interactive mode works without code changes
  6. Maintained: Actively developed as part of Constructive tooling
By standardizing on inquirerer, developers can move between Constructive projects and immediately understand how CLI tools work without learning different libraries.
inquirerer是所有Constructive monorepo的标准CLI库,因为它为我们所有项目提供了统一的开发方案:
  1. 一致性:所有Constructive CLI工具都拥有统一的外观、交互体验和行为逻辑
  2. TypeScript优先:为输入问题和返回结果提供完整的类型安全保障
  3. 高集成度:单个库即可覆盖参数解析、提示、UI组件等全部需求
  4. 动态默认值:内置git配置、npm、日期、工作区信息的解析器
  5. 适配CI/CD:无需修改代码即可支持非交互模式运行
  6. 持续维护:作为Constructive工具链的一部分持续迭代更新
通过统一使用inquirerer,开发者在不同Constructive项目之间切换时,无需额外学习其他库即可快速理解CLI工具的实现逻辑。

References

参考资料