← ClaudeAtlas

cleyelisted

Type-safe CLI argument parsing with cleye, the standard parser for this repo's Bun scripts. Use when writing or editing any script that takes arguments (flags, positional parameters, subcommands, --help) instead of reading existing scripts for the pattern.
bendrucker/claude · ★ 15 · Data & Documents · score 73
Install: claude install-skill bendrucker/claude
# cleye Type-safe CLI argument parsing for Bun scripts. Used across plugin scripts for flags, parameters, and subcommands. ## Basic Usage ```ts #!/usr/bin/env bun import { cli } from "cleye"; const argv = cli({ name: "my-script", parameters: ["<file>"], flags: { output: { type: String, alias: "o", description: "Output path", }, verbose: Boolean, }, }); console.log(argv._.file); // string (required) console.log(argv.flags.output); // string | undefined console.log(argv.flags.verbose); // boolean | undefined ``` ## Parameters Positional arguments mapped to named properties on `argv._`: ```ts parameters: [ "<required>", // must be provided "[optional]", // may be omitted "<files...>", // required variadic (1+), must be last "[files...]", // optional variadic (0+), must be last ] ``` Required parameters must precede optional. Variadic must be last. Access: `argv._.required`, `argv._.optional`, `argv._.files`. ## Flags Flags accept a type constructor or a config object: ```ts fragment flags: { name: String, // shorthand count: { type: Number, alias: "n", default: 10, description: "Max results", }, tags: { type: [String], // array: -t foo -t bar description: "Tag names", }, json: { type: Boolean, description: "Output as JSON", }, } ``` Kebab-case flags (`--dry-run`) become camelCase properties (`argv.flags.dryRun`). ## H