API Reference

cleye

Type-safe CLI argument parser with subcommands, positional args, and auto-generated help, built on a declarative schema.

Official Documentation ↗
CompatibilityThis documentation covers version v2.7.0. Check the official docs for the latest API surface.

Installation

npmnpm install cleye

Methods

cleye is type-safe cli argument parser with subcommands, positional args, and auto-generated help, built on a declarative schema. This page documents the core methods, installation, and common usage patterns for the current stable release.

Installation

Install cleye with your preferred package manager using the command shown in the frontmatter. The package is published to the npm registry and ships with TypeScript types where applicable.

Core methods

The methods listed in the frontmatter cover the primary API surface. Each signature reflects the v1.3 release. Consult the official documentation linked in sourceUrl for advanced options, edge cases, and breaking changes between major versions.

Frequently asked questions

The faq section in the frontmatter answers the most common questions about cleye, including comparisons with alternatives, configuration tips, and runtime requirements. If your question is not covered, check the source URL for the full guide.

Errors

The following points are quoted verbatim from the official documentation. 来源:https://cdn.jsdelivr.net/gh/privatenumber/cleye@latest/README.md · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:48:52.053Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.

API reference evidence

Fetched from official sources on 2026-11-08T18:41:00+08:00 via WebFetch https://cdn.jsdelivr.net/gh/privatenumber/cleye@latest/README.md;HTTP GET https://unpkg.com/[email protected]/dist/index.d.mts.

  • cli → signature from https://unpkg.com/[email protected]/dist/index.d.mts; official text: “declare function cli(options: CliOptions, callback?: CallbackFunction, argv?: string[]): ParseArgv<CliOptions, string[], undefined>;”
  • command → signature from https://unpkg.com/[email protected]/dist/index.d.mts; official text: “declare function command<Options extends CommandOptions<[…Parameters]>, Parameters extends string[]>(options: Readonly & CommandOptions<[…Parameters]>, callback?: CallbackFunction<ParseArgv<Options, Paramete”

FAQ

Does it generate help text?
Yes. Pass help: true or use the built-in --help flag; cleye prints usage from the schema.
Is it ESM?
Yes. v1 is ESM-only.
Can I use positional args?
Yes. Define positionals in the schema; they appear as args._ in the callback.