CerebroInstallation
Installation
Last updated:
Installation
Install Cerebro using your preferred package manager:
npm install @visulima/cerebroPeer Dependencies
Cerebro has minimal dependencies by default. Install optional peer dependencies as needed:
Required Dependencies
npm install @visulima/command-line-args @visulima/errorOptional Features
Boxed Output (for formatted messages):
npm install @visulima/boxenAdvanced Logging (Pail integration):
npm install @visulima/pailShell Completion:
npm install @visulima/fs @visulima/pathREADME Generation:
npm install @visulima/readgenImport
ESM (Recommended)
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!