CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-oclif

A comprehensive CLI framework for creating command-line interfaces in Node.js and TypeScript

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

Overview
Eval results
Files

oclif

oclif (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.

Package Information

  • Package Name: oclif
  • Package Type: npm
  • Language: TypeScript
  • Installation: npm install oclif

Core Imports

import { run } from "oclif";

For CommonJS:

const { run } = require("oclif");

Basic Usage

CLI Usage

# 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-x64

Programmatic Usage

import { run } from "oclif";

// Execute CLI programmatically
await run(["help"]);
await run(["generate", "my-new-cli"]);

Architecture

oclif is built around several key components:

  • CLI Framework: Built on top of @oclif/core for command execution and parsing
  • Code Generation: Template-based generation of CLI projects, commands, and hooks
  • Build System: Cross-platform packaging for tarballs, installers, and distribution packages
  • Distribution: S3-based hosting and automatic update mechanisms
  • Plugin System: Extensible architecture supporting plugin development and distribution

Capabilities

Core CLI Management

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 manifest

CLI Management

Code Generation

Generate 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 CLI

Code Generation

Packaging and Distribution

Package 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 Windows

Packaging

Upload and Deployment

Upload 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 channel

Upload and Deployment

Legacy Utilities

Deprecated commands maintained for backwards compatibility.

// CLI Commands Available:
// oclif lock - Copy yarn.lock to oclif.lock (deprecated)

Programmatic API

Direct access to oclif functionality for programmatic usage and custom integrations.

function run(argv?: string[], options?: LoadOptions): Promise<void>;

Programmatic API

Types

interface LoadOptions {
  root?: string;
  channel?: string;
  development?: boolean;
}

Install with Tessl CLI

npx tessl i tessl/npm-oclif
Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/oclif@4.22.x
Publish Source
CLI
Badge
tessl/npm-oclif badge