Skip to content
zodline
Esc
navigateopen⌘Jpreview
On this page

Installation

Install zodline and its Zod peer dependency, and check the runtime requirements.

zodline needs Zod v4 alongside it. Zod is a peer dependency, so install both:

npm install zodline zod
pnpm add zodline zod
yarn add zodline zod
bun add zodline zod

Requirements

PropType
Node?string

Uses only standard library APIs.

Typestring
Default>= 16
Module?string

Package "type": "module". No CommonJS build.

Typestring
DefaultESM
Zod?string

Peer dependency. Provide it yourself.

Typestring
Default^4.0.0
Dependencies?string

No runtime dependencies beyond the Zod peer.

Typestring
Default0

Import

Everything is exported from the package root:

import {
  defineCommand,
  defineConfig,
  defineOptions,
  processConfig,
  ZodlineError,
} from 'zodline';

Types are exported as well:

import type {
  CommandDefinition,
  DefineConfig,
  OptionsDefinition,
  ProcessResult,
} from 'zodline';

ESM only

zodline ships as ES modules with no CommonJS build. In a Node.js project, either set "type": "module" in your package.json or use the .mjs extension for your entry file.

Make it executable

A CLI is a file with a shebang, wired up through the bin field:

#!/usr/bin/env node
import { processConfig } from 'zodline';
import { config } from './config.js';

const result = processConfig(config, process.argv.slice(2));
await result.command.action(result.options, result.args);
{
  "type": "module",
  "bin": {
    "my-cli": "./cli.js"
  }
}

Continue to the Quickstart

Define your first command, parse argv, and run it.

Last updated on August 6, 2026

Was this page helpful?