Type-safe CLI command definition and execution.
npm install @wollybeard/oak zod
# or
pnpm add @wollybeard/oak zod
# or
yarn add @wollybeard/oak zodNote:
zodv4 is a peer dependency.
- 🔒 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)
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.`)Check out the examples directory for more usage patterns:
- intro.ts - Basic usage
- prompt.ts - Interactive prompts
- kitchen-sink.ts - Advanced features
- publish.ts - Real-world example
For detailed documentation, see the JSDoc comments in the source code.
- OClif - Full-featured CLI framework
- Commander - Popular CLI framework
- Yargs - Traditional CLI parser
- Arg - Simple argument parser
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.
MIT