https://github.com/andreas-timm/cli-ts
Helpers for building Bun and TypeScript CLIs on top of cac
https://github.com/andreas-timm/cli-ts
bun cac cli completion typescript zsh
Last synced: about 2 months ago
JSON representation
Helpers for building Bun and TypeScript CLIs on top of cac
- Host: GitHub
- URL: https://github.com/andreas-timm/cli-ts
- Owner: andreas-timm
- License: bsd-3-clause
- Created: 2026-04-26T23:34:39.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2026-04-28T22:29:02.000Z (about 2 months ago)
- Last Synced: 2026-04-29T00:24:34.490Z (about 2 months ago)
- Topics: bun, cac, cli, completion, typescript, zsh
- Language: TypeScript
- Homepage:
- Size: 58.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @andreas-timm/cli
Helpers for building Bun and TypeScript CLIs on top of `cac`.
## Features
- Register commands and aliases with a small typed wrapper around `cac`.
- Normalize multi-word commands, `help`, `-h`, and `--help` flows.
- Add declarative options with defaults, required flags, choices, and validation.
- Generate zsh completion, including option value choices and path inference.
- Install app CLIs into `~/.local/bin` with a reusable command helper.
## Install
```sh
npm install @andreas-timm/cli
```
## Usage
```ts
import { cac } from "cac";
import {
installDefaultCommandHelp,
installSubcommandHelp,
registerCommands,
run,
} from "@andreas-timm/cli";
const cli = cac("example");
registerCommands(cli, ["build", "b"], "Build the project", (command) => {
command.option("--watch", "Watch files");
command.action(async (options) => {
console.log("build", options);
});
});
installDefaultCommandHelp(cli);
installSubcommandHelp(cli);
await run(cli);
```
For the full CLI patterns, option rules, completion behavior, and install-command guidance, see [`skills/bun-cli/SKILL.md`](./skills/bun-cli/SKILL.md).
## Agent skill `bun-cli`
The package ships a Cursor/Agent skill named **bun-cli** so assistants can follow consistent patterns for `cac`, command registration, help, completion, and related CLI work.
- In this repo: [`skills/bun-cli/SKILL.md`](./skills/bun-cli/SKILL.md)
- After installation: `node_modules/@andreas-timm/cli/skills/bun-cli/` (same `SKILL.md` and assets)
To expose the installed skill under a project-local skills directory (paths vary with monorepo layout; point the symlink at `node_modules/@andreas-timm/cli/skills/bun-cli`):
```sh
mkdir -p .agents/skills
ln -s ../../node_modules/@andreas-timm/cli/skills/bun-cli .agents/skills/bun-cli
```