Optique is a type-safe combinatorial command-line interface (CLI) parser designed specifically for TypeScript. It enables developers to construct CLI parsers by composing small, reusable functions, allowing for the creation of option groups and alternatives through combinators like merge() and or(). The tool emphasizes expressing CLI constraints directly in code structure, rather than relying on separate validation logic, which helps catch invalid argument combinations at parse time.
A key feature of Optique is its automatic type inference, leveraging TypeScript to deduce result types from parser composition, including discriminated unions for subcommands and optional fields. This approach minimizes the need for manual type annotations, streamlining development for TypeScript users. The parser structure also supports encoding constraints such as mutually exclusive option groups at the type level, ensuring that only valid combinations are accepted.
Optique provides several utilities for enhancing CLI applications. It can generate shell completion scripts for Bash, zsh, fish, PowerShell, and Nushell, keeping suggestions aligned with the current parser definitions. Man page generation is supported through the @optique/man package, producing Unix man pages in standard man(7) roff format directly from parser definitions. The platform also allows for multi-source value resolution, layering CLI arguments, environment variables, configuration files, and interactive prompts with a clear priority order. Integration packages work seamlessly with the same combinators as the core parsers.
The tool is aimed at TypeScript developers who require robust, type-safe command-line interfaces with advanced features such as shell completion, man page generation, and multi-source configuration. Optique is delivered as a set of packages for the TypeScript ecosystem, with references to modules like @optique/core, @optique/run, and others supporting various integrations.
In the CLI tools & terminal space, Optique takes a focused approach. It focuses on simplifying the creation of robust, type-safe CLI parsers in TypeScript projects. It is built as an open-source project for typeScript developers. Optique is open source under the MIT license. It runs on the web and the command line, and it can be self-hosted.
Optique first shipped in 2025. Development happens publicly on GitHub with 703 stars and 953 commits in the last 90 days. Key capabilities include type-safe parsing, combinatorial parsers, and shell completion.
Latest indexed changes and source events
Other apps tracked under the same category.