CerebroAPI ReferenceAPI Overview

API Overview

Last updated:

API Overview

Complete API reference for Cerebro CLI framework.

Core API

createCerebro()

Create a new CLI instance:

function createCerebro<T extends Console = Console>(
  name: string,
  options?: CliOptions<T>
): Cerebro<T>

Parameters:

  • name - CLI application name
  • options - Configuration options (optional)

Returns: Configured Cerebro instance

Example:

const cli = createCerebro("my-cli", {
  packageName: "my-cli",
  packageVersion: "1.0.0",
});

Cerebro Class

Main CLI class with the following methods:

addCommand()

Register a command:

cli.addCommand(command: Command): void

use()

Register a plugin:

cli.use(plugin: Plugin): void

run()

Execute the CLI:

await cli.run(argv?: string[]): Promise<void>

setDefaultCommand()

Set default command:

cli.setDefaultCommand(name: string): void

getCommands()

Get all registered commands:

cli.getCommands(): Map<string, Command>

Built-in Commands

  • HelpCommand - Display help text
  • VersionCommand - Show version
  • CompletionCommand - Shell completion
  • ReadmeCommand - Generate README

Built-in Plugins

  • errorHandlerPlugin - Error handling
  • runtimeVersionCheckPlugin - Version validation
  • updateNotifierPlugin - Update notifications

Type Definitions

  • Command - Command definition interface
  • Plugin - Plugin definition interface
  • Toolbox - Execution context interface
  • CliOptions - CLI configuration options
  • OptionDefinition - Option definition interface
  • ArgumentDefinition - Argument definition interface
  • EnvDefinition - Environment variable definition

Constants

  • VERBOSITY_QUIET - Quiet output level
  • VERBOSITY_NORMAL - Normal output level
  • VERBOSITY_VERBOSE - Verbose output level
  • VERBOSITY_DEBUG - Debug output level
Support

Contribute to our work and keep us going

Community is the heart of open source. The success of our packages wouldn't be possible without the incredible contributions of users, testers, and developers who collaborate with us every day.Want to get involved? Here are some tips on how you can make a meaningful impact on our open source projects.

Ready to help us out?

Be sure to check out the package's contribution guidelines first. They'll walk you through the process on how to properly submit an issue or pull request to our repositories.

Submit a pull request

Found something to improve? Fork the repo, make your changes, and open a PR. We review every contribution and provide feedback to help you get merged.

Good first issues

Simple issues suited for people new to open source development, and often a good place to start working on a package.
View good first issues