PACKAGE · CLI

citty

Elegant CLI Builder

WEEKLY DOWNLOADS 11.4M
STARS 1.3K
FORKS 49
OPEN ISSUES 56
GZIP SIZE 3.7 kB
UNPACKED SIZE 34.6 kB
DEPENDENCIES 1
LAST UPDATED 3mo ago
DOWNLOAD TRENDS

citty downloads — last 12 months

Download trends for citty1 download series from Jun 2025 to May 2026. Use left and right arrow keys to inspect monthly values.021.8M43.6M65.4M87.2MJun 2025SepDecMarMay 2026
citty
ABOUT CITTY

Citty is designed to streamline the creation of command-line interfaces (CLIs) with an elegant and developer-friendly API. It addresses the common challenge of building sophisticated command structures, argument parsing, and help message generation, allowing developers to focus on application logic rather than boilerplate CLI scaffolding. The package provides a declarative way to define commands, options, and arguments, making complex CLI applications more manageable.

Its core philosophy centers on simplicity, expressiveness, and a positive developer experience. Citty aims to be intuitive for developers familiar with modern JavaScript patterns, offering a clean syntax that leads to readable and maintainable CLI code. The primary audience includes developers building standalone CLI tools, task runners, or integration scripts that require a robust command-line interface.

The package employs a pattern-based approach to API definition. Developers can define commands using a fluent API, chaining methods to specify parameters, types, descriptions, and default values. This includes handling nested commands and subcommands effectively, mirroring the hierarchical nature of many CLI tools. Features like automatic type coercion and validation are built into the parsing process.

Citty integrates seamlessly into typical Node.js development workflows. It can be used to build CLIs that are invoked directly via `npx` or as part of larger application build processes. Its output can be easily consumed by shell scripts or other automated tasks, making it a versatile tool for developers working with the Node.js ecosystem.

With a weekly download count of 20.1 million and a compact unpacked size of 34.6 kB (3.0 kB gzip), Citty demonstrates excellent performance characteristics and a minimal footprint. Its small bundle size ensures that it adds negligible overhead to applications, which is crucial for CLI tools that need to start quickly. The project has accumulated 1.2K GitHub stars, indicating significant community interest and adoption.

While Citty offers a powerful set of features for building CLIs, developers should be aware of its specific API conventions. It is primarily focused on command-based CLIs; for applications requiring more complex interactive prompts or TUI elements, additional libraries might be necessary. The current open issue count of 49 suggests an active development and community engagement, but also indicates areas where further refinement might be ongoing.

WHEN TO USE
  • When defining nested commands and subcommands with clear hierarchical structures using chained API calls.
  • When automatically generating help messages and argument validation based on declarative command definitions.
  • When needing robust argument parsing with automatic type coercion for common JavaScript types.
  • When building task runners or utility scripts that require multiple commands with distinct options.
  • When aiming for a concise and readable CLI definition that mirrors command structure closely.
  • When integrating CLI functionality into a Node.js project with minimal bundle size impact.
WHEN NOT TO USE
  • If your CLI solely involves very basic argument parsing with no nested commands or complex options, a simpler approach might suffice.
  • If you require advanced interactive TUI elements like progress bars or complex dialogs, you will likely need to combine citty with other specialized libraries.
  • When building CLIs that are intended to be extremely small and have zero external dependencies beyond Node.js itself.
  • If your command-line tool primarily needs to execute single, straightforward commands without argument variations.
  • When the project mandates using a specific, different CLI building paradigm that does not align with citty's declarative, fluent API.

CORRECTIONS

Spot wrong data here?

A short note helps us fix it.

Anonymous · No account · No email back

COMPARISONS 3
citty vs yargs ★ 11.5K · 96.8M/wk citty vs cac ★ 3.1K · 18.6M/wk citty vs commander ★ 28.2K · 204.6M/wk