Auditboard CLI

0.3.0-dev.2 · active · verified Wed Apr 22

The `auditboard-cli` is a Node.js-based command-line interface (CLI) tool designed to boost developer productivity by enabling the creation and automation of custom tasks within JavaScript projects. Currently in version `0.3.0-dev.2`, it follows an iterative release cadence typical for early-stage development. Inspired by task runners like Ruby's Rake and Laravel's Artisan, this CLI allows developers to define project-specific commands within an `ab-cli-commands` directory, or create global utilities stored in `~/.ab-cli-commands`. Its core differentiation lies in supporting both local and global command definitions with a simple, CommonJS-based API for command creation, including clear mechanisms for defining required and optional arguments. It abstracts argument parsing, allowing developers to focus on command logic.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to install the CLI, create a custom command, define its arguments, and execute it locally within a project.

// 1. Install auditboard-cli in your project
npm install auditboard-cli

// 2. Create a new command named 'greet'
// Run this in your project's root directory:
npx auditboard make:command greet

// 3. Locate the generated command file: ab-cli-commands/greet.js
// Replace its content with the following:
/*
module.exports = {
  async command(args) {
    const name = args.name || 'World'; // Access required arg 'name'
    const greeting = args.message || 'Hello'; // Access optional arg 'message'
    console.log(`${greeting} ${name}!`);
    return `Successfully greeted '${name}' with '${greeting}'.`;
  },
  commandOptions: {
    help: 'Greets a person by name, with an optional custom message.',
    description: 'A simple greeting command example',
    required: [
      {
        name: 'name',
        message: 'A name is required for the greeting.',
      },
    ],
    args: {
      '--message': String,
      '-m': '--message',
    },
  },
};
*/

// 4. Run your custom 'greet' command
// Example with required 'name' and optional 'message':
npx auditboard greet Alice --message "Hi there"
// Expected output:
// Hi there Alice!
// Successfully greeted 'Alice' with 'Hi there'.

// Example with only the required 'name':
npx auditboard greet Bob
// Expected output:
// Hello Bob!
// Successfully greeted 'Bob' with 'Hello'.

view raw JSON →