interface ICliApi
Since 0.1.0

CLI command registration surface: a plugin publishes commands here, and the kernel registers each under CAPABILITIES.CLI_COMMAND as a multi-provider token that any consumer can read with getAll.

@setu-ts/cli reads these: setu commands lists them and setu <name> runs one. Doing so requires importing and booting the application, so the CLI loads it through the project's setu.config.ts (createApp()) and starts it with no port — which registers plugins without binding a socket. Two plugins registering the same name is refused rather than resolved by load order.

Examples

Example 1

register(ctx: IPluginContext): void {
  ctx.cli.register('db:migrate', async (args) => {
    await migrate(args[0] ?? 'latest');
  });
}

Methods

register(
name: string,
): void

Registers a CLI command.

Usage

import { type ICliApi } from "common/src/index.ts";