Member Junction
    Preparing search index...

    Class BaseCLIPluginAbstract

    Abstract base for every pluggable mj command (plan D1/D2).

    Extends oclif's Command, so oclif still owns flag parsing, help generation, and routing. We wrap only the execution layer: subclasses implement BaseCLIPlugin.Execute (pure logic, returns data) and the shared BaseCLIPlugin.run wires up the IMJCLIRuntimeHost, emits the runtime advisory, renders the result per --format, and sets the exit code.

    The global flags --format, --verbose, and --no-banner are declared on BaseCLIPlugin.baseFlags and inherited by every subclass via oclif's native baseFlags merging — no per-command duplication (plan D3).

    Hierarchy

    • Command
      • BaseCLIPlugin
    Index

    Constructors

    • Parameters

      • argv: string[]
      • config: Config

      Returns BaseCLIPlugin

    Properties

    argv: string[]
    config: Config
    debug: (...args: any[]) => void
    id: string
    aliases: string[]

    An array of aliases for this command.

    args: ArgInput

    An order-dependent object of arguments for the command

    baseFlags: {
        format: OptionFlag<string, CustomOptions>;
        "no-banner": BooleanFlag<boolean>;
        verbose: BooleanFlag<boolean>;
    } = ...

    Inherited by every subclass through oclif's static baseFlags mechanism.

    deprecateAliases?: boolean

    Emit deprecation warning when a command alias is used

    deprecationOptions?: Deprecation
    description: string

    A full description of how to use the command.

    If no summary, the first line of the description will be used as the summary.

    enableJsonFlag: boolean
    examples: Example[]

    An array of examples to show at the end of the command's help.

    IF only a string is provided, it will try to look for a line that starts with the cmd.bin as the example command and the rest as the description. If found, the command will be formatted appropriately.

    EXAMPLES:
    A description of a particular use case.

    $ <%= config.bin => command flags
    flags: FlagInput

    A hash of flags for the command

    hasDynamicHelp: boolean
    help: string
    hidden: boolean

    Hide the command from help

    hiddenAliases: string[]

    An array of aliases for this command that are hidden from help.

    id: string

    A command ID, used mostly in error or verbose reporting.

    plugin: Plugin
    pluginAlias?: string
    pluginName?: string
    pluginType?: string
    state?: string

    Mark the command as a given state (e.g. beta or deprecated) in help

    strict: boolean

    When set to false, allows a variable amount of arguments

    summary?: string

    The tweet-sized description for your class, used in a parent-commands sub-command listing and as the header for the command help.

    usage: string | string[]

    An override string (or strings) for the default usage documentation.

    Every plugin declares its own usage + runtime metadata. The CLI root reads this off the registered classes to assemble the progressive-disclosure mj usage / mj <domain> usage surface and the timeout advisory. Subclasses MUST override.

    Accessors

    • get ctor(): typeof Command

      Returns typeof Command

    Methods

    • Type Parameters

      • T

      Returns Promise<T>

    • Parameters

      • err: CommandError

      Returns Promise<any>

    • Optional post-Emit hook. Override to release resources (DB pools, singletons) and, when necessary, process.exit() to terminate lingering background work.

      Parameters

      Returns Promise<void>

    • Parameters

      • input: string | Error
      • options: { code?: string; exit: false } & PrettyPrintableError

      Returns void

    • Parameters

      • input: string | Error
      • Optionaloptions: { code?: string; exit?: number } & PrettyPrintableError

      Returns never

    • Parameters

      • Optionalcode: number

      Returns never

    • Parameters

      • _: Error

      Returns Promise<any>

    • The flags parsed for this command. Subclasses call this in Execute instead of re-parsing — the parse happens once, in run.

      The as unknown as T is the ONE place the cross-package @oclif/core copy split is bridged: cli-core nests its own oclif, so the inferred parse type isn't nameable from a strict consumer package (TS2742). Confining the cast here keeps every plugin's Execute() cast-free. Pass Interfaces.InferredFlags<typeof YourPlugin.flags> as T.

      Type Parameters

      • T

      Returns T

    • Returns Promise<any>

    • Determine if the command is being run with the --json flag in a command that supports it.

      Returns boolean

      true if the command supports json and the --json flag is present

    • Parameters

      • Optionalmessage: string
      • ...args: any[]

      Returns void

    • Parameters

      • json: unknown

      Returns void

    • Parameters

      • Optionalmessage: string
      • ...args: any[]

      Returns void

    • Type Parameters

      • F extends FlagOutput
      • B extends FlagOutput
      • A extends ArgOutput

      Parameters

      • Optionaloptions: Input<F, B, A>
      • Optionalargv: string[]

      Returns Promise<ParserOutput<F, B, A>>

    • oclif entry point — do NOT override in subclasses. Override Execute.

      Returns Promise<void>

    • Parameters

      • err: unknown

      Returns any

    • Parameters

      • result: unknown

      Returns any

    • Parameters

      • input: string | Error

      Returns string | Error

    • Returns void

    • Parameters

      • flags: Record<string, unknown>

      Returns void

    • instantiate and run the command

      Type Parameters

      • T extends Command

      Parameters

      • this: new (argv: string[], config: Config) => T

        the command class

      • Optionalargv: string[]

        argv

      • Optionalopts: LoadOptions

        options

      Returns Promise<ReturnType<T["run"]>>

      result