A comprehensive CLI framework for creating command-line interfaces in Node.js and TypeScript
npx @tessl/cli install tessl/npm-oclif@4.22.0oclif (Open CLI Framework) is a comprehensive framework for building command-line interfaces in Node.js and TypeScript. It provides scaffolding, packaging, and distribution tools for creating production-ready CLIs with features like automatic help generation, command validation, argument parsing, and multi-platform distribution.
npm install oclifimport { run } from "oclif";For CommonJS:
const { run } = require("oclif");# Generate a new CLI project
oclif generate my-cli
# Initialize oclif in existing project
oclif init
# Generate README documentation
oclif readme
# Create plugin manifest
oclif manifest
# Package for distribution
oclif pack tarballs --targets=linux-x64,darwin-x64import { run } from "oclif";
// Execute CLI programmatically
await run(["help"]);
await run(["generate", "my-new-cli"]);oclif is built around several key components:
Essential commands for creating and managing CLI projects, including project initialization and README generation.
// CLI Commands Available:
// oclif generate [NAME] - Generate new CLI project
// oclif init - Initialize oclif in existing project
// oclif readme - Generate README documentation
// oclif manifest [PATH] - Create plugin manifestGenerate CLI components including commands and hooks using customizable templates.
// CLI Commands Available:
// oclif generate command [NAME] - Add command to CLI
// oclif generate hook - Add hook to CLIPackage CLIs into distributable formats including tarballs, installers, and platform-specific packages.
// CLI Commands Available:
// oclif pack tarballs - Package into tarballs
// oclif pack deb - Package for Debian/Ubuntu
// oclif pack macos - Package for macOS
// oclif pack win - Package for WindowsUpload packaged CLIs to S3 and manage distribution channels.
// CLI Commands Available:
// oclif upload tarballs - Upload tarballs to S3
// oclif upload deb - Upload Debian packages to S3
// oclif upload macos - Upload macOS packages to S3
// oclif upload win - Upload Windows packages to S3
// oclif promote - Promote builds to release channelDeprecated commands maintained for backwards compatibility.
// CLI Commands Available:
// oclif lock - Copy yarn.lock to oclif.lock (deprecated)Direct access to oclif functionality for programmatic usage and custom integrations.
function run(argv?: string[], options?: LoadOptions): Promise<void>;interface LoadOptions {
root?: string;
channel?: string;
development?: boolean;
}