citty is a modern, elegant, and highly performant CLI builder for Node.js, currently stable at version `0.2.2`. It distinguishes itself by being entirely zero-dependency since `v0.2.0`, leveraging Node.js's native `util.parseArgs` for its core argument parsing. This design choice results in a significantly reduced install size (from 267kB to 22.8kB as of `v0.2.0`) and fast execution, making it an excellent choice for lightweight command-line tools. `citty` provides a flexible and composable API that supports nested sub-commands, complete with options for lazy and asynchronous loading, which is crucial for building large-scale CLIs without incurring heavy startup costs. Recent enhancements in `v0.2.2` introduced a robust plugin system, allowing developers to extend command functionality with reusable `setup` and `cleanup` hooks. It also offers smart value parsing, type casting, boolean shortcuts, and automatically generates comprehensive usage information. The project maintains an active release cadence, frequently adding new features and addressing issues, demonstrating its ongoing development and commitment to a stable and feature-rich experience.
npm install cittyVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to define a main command with positional and optional arguments, including `setup`, `run`, and `cleanup` hooks. It shows basic argument parsing and execution flow.
Review your CLI argument parsing logic, especially for edge cases or complex argument structures, if upgrading from versions prior to `v0.2.0`. This change generally simplifies the dependency graph.
Upgrade to `v0.2.2` or higher. This version includes a fix that properly allows users to define and override these arguments within their command's `args` configuration, ensuring consistent behavior.
For full support and expected behavior of subcommand aliases, default subcommands, and the plugin system, ensure you are using `citty@0.2.2` or newer. Refactor any custom logic to utilize the new official APIs.
Run `npm install citty` or `yarn add citty`. Ensure your package.json `type` is set to `module` or your file uses the `.mjs` extension for ESM imports.
Ensure all required positional or named arguments are supplied on the command line. For example, if 'name' is required, run `your-cli <value_for_name>`.
Either define the argument in your command's `args` object with the correct type, or remove the unknown argument from the CLI call.
Verify that lazy-loaded subcommands correctly return the default export of a `defineCommand` result. Ensure promises for `Resolvable<T>` types are awaited or handled correctly, particularly in `subCommands` configurations.
No dependency data recorded yet.