Installation

Last updated:

Installation

Install Cerebro using your preferred package manager:

npm install @visulima/cerebro

Peer Dependencies

Cerebro has minimal dependencies by default. Install optional peer dependencies as needed:

Required Dependencies

npm install @visulima/command-line-args @visulima/error

Optional Features

Boxed Output (for formatted messages):

npm install @visulima/boxen

Advanced Logging (Pail integration):

npm install @visulima/pail

Shell Completion:

npm install @visulima/fs @visulima/path

README Generation:

npm install @visulima/readgen

Import

import { createCerebro } from "@visulima/cerebro";

CommonJS

const { createCerebro } = require("@visulima/cerebro");

Subpath Imports

Cerebro provides subpath imports for built-in commands and plugins:

// Built-in commands
import { HelpCommand } from "@visulima/cerebro/command/help";
import { VersionCommand } from "@visulima/cerebro/command/version";
import { CompletionCommand } from "@visulima/cerebro/command/completion";
import { ReadmeCommand } from "@visulima/cerebro/command/readme";

// Plugins
import { errorHandlerPlugin } from "@visulima/cerebro/plugin/error-handler";
import { runtimeVersionCheckPlugin } from "@visulima/cerebro/plugin/runtime-version-check";
import { updateNotifierPlugin } from "@visulima/cerebro/plugin/update-notifier";

Requirements

  • Node.js: 18.x or higher
  • TypeScript: 5.0 or higher (for TypeScript projects)
  • Package Manager: npm, yarn, pnpm, or bun

Verification

Verify your installation by creating a simple CLI:

import { createCerebro } from "@visulima/cerebro";

const cli = createCerebro("test-cli");

cli.addCommand({
  name: "hello",
  description: "Say hello",
  execute: ({ logger }) => {
    logger.log("Hello from Cerebro!");
  },
});

await cli.run(["hello"]);
// Output: Hello from Cerebro!
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