NAME
oak — ⚡️ CLI building blocks & framework for the TypeScript era.
SYNOPSIS
INFO
DESCRIPTION
⚡️ CLI building blocks & framework for the TypeScript era.
README
@wollybeard/oak
Type-safe CLI command definition and execution.
Installation
npm install @wollybeard/oak zod
# or
pnpm add @wollybeard/oak zod
# or
yarn add @wollybeard/oak zod
Note:
zodv4 is a peer dependency.
Features
- 🔒 Type-safe - Full TypeScript support with strong type inference
- 🎨 Interactive prompts - Built-in prompt support for missing parameters
- 🌍 Environment variables - Automatic environment variable parsing
- 📝 Auto-generated help - Beautiful help documentation generated automatically
- 🔌 Extensible - Support for custom schemas via extensions (Zod included)
Quick Start
import { Command } from '@wollybeard/oak' import { Zod } from '@wollybeard/oak/extensions' import { z } from 'zod/v4'const args = Command.create() .use(Zod) .parameter('name', z.string()) .parameter('age', z.number().optional()) .parse()
console.log(Hello ${args.name}!) if (args.age) console.log(You are ${args.age} years old.)
Examples
Check out the examples directory for more usage patterns:
- intro-zod.ts - Basic usage with Zod
- intro-effect.ts - Basic usage with Effect Schema
- optional-effect.ts - Effect Schema optional patterns
- prompt.ts - Interactive prompts
- kitchen-sink.ts - Advanced features
- publish.ts - Real-world example
Documentation
For detailed documentation, see the JSDoc comments in the source code.
Alternatives
- OClif - Full-featured CLI framework
- Commander - Popular CLI framework
- Yargs - Traditional CLI parser
- Arg - Simple argument parser
Migration from @molt/command
This package was previously published as @molt/command. To migrate:
Update your imports:
// Before import { Command } from '@molt/command'// After import { Command } from '@wollybeard/oak'Update your package.json:
{ "dependencies": { "@wollybeard/oak": "^0.9.0" } }
The API remains the same - only the package name has changed.
License
MIT