or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

cli-management.mdcode-generation.mdindex.mdpackaging.mdprogrammatic-api.mdupload-deployment.md

index.mddocs/

0

# oclif

1

2

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.

3

4

## Package Information

5

6

- **Package Name**: oclif

7

- **Package Type**: npm

8

- **Language**: TypeScript

9

- **Installation**: `npm install oclif`

10

11

## Core Imports

12

13

```typescript

14

import { run } from "oclif";

15

```

16

17

For CommonJS:

18

19

```javascript

20

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

21

```

22

23

## Basic Usage

24

25

### CLI Usage

26

27

```bash

28

# Generate a new CLI project

29

oclif generate my-cli

30

31

# Initialize oclif in existing project

32

oclif init

33

34

# Generate README documentation

35

oclif readme

36

37

# Create plugin manifest

38

oclif manifest

39

40

# Package for distribution

41

oclif pack tarballs --targets=linux-x64,darwin-x64

42

```

43

44

### Programmatic Usage

45

46

```typescript

47

import { run } from "oclif";

48

49

// Execute CLI programmatically

50

await run(["help"]);

51

await run(["generate", "my-new-cli"]);

52

```

53

54

## Architecture

55

56

oclif is built around several key components:

57

58

- **CLI Framework**: Built on top of @oclif/core for command execution and parsing

59

- **Code Generation**: Template-based generation of CLI projects, commands, and hooks

60

- **Build System**: Cross-platform packaging for tarballs, installers, and distribution packages

61

- **Distribution**: S3-based hosting and automatic update mechanisms

62

- **Plugin System**: Extensible architecture supporting plugin development and distribution

63

64

## Capabilities

65

66

### Core CLI Management

67

68

Essential commands for creating and managing CLI projects, including project initialization and README generation.

69

70

```typescript { .api }

71

// CLI Commands Available:

72

// oclif generate [NAME] - Generate new CLI project

73

// oclif init - Initialize oclif in existing project

74

// oclif readme - Generate README documentation

75

// oclif manifest [PATH] - Create plugin manifest

76

```

77

78

[CLI Management](./cli-management.md)

79

80

### Code Generation

81

82

Generate CLI components including commands and hooks using customizable templates.

83

84

```typescript { .api }

85

// CLI Commands Available:

86

// oclif generate command [NAME] - Add command to CLI

87

// oclif generate hook - Add hook to CLI

88

```

89

90

[Code Generation](./code-generation.md)

91

92

### Packaging and Distribution

93

94

Package CLIs into distributable formats including tarballs, installers, and platform-specific packages.

95

96

```typescript { .api }

97

// CLI Commands Available:

98

// oclif pack tarballs - Package into tarballs

99

// oclif pack deb - Package for Debian/Ubuntu

100

// oclif pack macos - Package for macOS

101

// oclif pack win - Package for Windows

102

```

103

104

[Packaging](./packaging.md)

105

106

### Upload and Deployment

107

108

Upload packaged CLIs to S3 and manage distribution channels.

109

110

```typescript { .api }

111

// CLI Commands Available:

112

// oclif upload tarballs - Upload tarballs to S3

113

// oclif upload deb - Upload Debian packages to S3

114

// oclif upload macos - Upload macOS packages to S3

115

// oclif upload win - Upload Windows packages to S3

116

// oclif promote - Promote builds to release channel

117

```

118

119

[Upload and Deployment](./upload-deployment.md)

120

121

### Legacy Utilities

122

123

Deprecated commands maintained for backwards compatibility.

124

125

```typescript { .api }

126

// CLI Commands Available:

127

// oclif lock - Copy yarn.lock to oclif.lock (deprecated)

128

```

129

130

### Programmatic API

131

132

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

133

134

```typescript { .api }

135

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

136

```

137

138

[Programmatic API](./programmatic-api.md)

139

140

## Types

141

142

```typescript { .api }

143

interface LoadOptions {

144

root?: string;

145

channel?: string;

146

development?: boolean;

147

}

148

```