Getting Started
Prerequisites
- Node.js >= 22.0.0
- A package manager (pnpm, npm, yarn, or bun)
Installation
bash
pnpm add -D laufenbash
npm install -D laufenbash
yarn add -D laufenbash
bun add -D laufenThe npm package is called laufen. The CLI binary is lauf.
Initialize
Run lauf init in your workspace root to scaffold a config file:
bash
lauf initThis creates a lauf.config.ts:
ts
import { defineConfig } from 'laufen';
export default defineConfig({
scripts: ['scripts/*.ts'],
});Write Your First Script
Create a file at scripts/hello.ts (or inside any workspace package at <package>/scripts/hello.ts):
ts
import { lauf, z } from 'laufen';
export default lauf({
description: 'Say hello',
args: {
name: z.string().default('world'),
loud: z.boolean().default(false),
},
async run(ctx) {
const greeting = `Hello, ${ctx.args.name}!`;
if (ctx.args.loud) {
ctx.logger.success(greeting.toUpperCase());
} else {
ctx.logger.success(greeting);
}
},
});Run It
bash
lauf run hello --name=Zac --loud=trueArguments are parsed, validated against your Zod schema, and passed to run() with full type safety.
If you omit the script name, Lauf presents an interactive picker:
bash
lauf runWhat's Next?
- Configuration -- customize script patterns and logger
- Writing Scripts -- the full
lauf()API and script context - CLI Reference -- all available commands
- Examples -- walkthrough of real scripts