Crust logoCrust

Core

Core framework library — command definition, parsing, routing, plugins, and errors.

The core package provides everything needed to define and run CLI commands. It has zero runtime dependencies.

Install

bun add @crustjs/core

Exports

Classes

ClassDescription
CrustChainable builder for defining CLI commands with full type inference

Functions

FunctionDescription
parseArgsParse argv against a command's arg/flag definitions
resolveCommandResolve a subcommand from an argv array
createCommandNodeCreate a fresh CommandNode (for downstream packages)
computeEffectiveFlagsMerge inherited + local flags at runtime

Constants

ConstantDescription
VALIDATION_MODE_ENVEnvironment variable name for build-time validation mode

Types

TypeDescription
CommandNodeInternal command tree node
CrustCommandContext<A, F>Runtime context passed to lifecycle hooks
CommandMetaCommand metadata (name, description, usage)
ArgDefPositional argument definition
ArgsDefTuple of argument definitions
FlagDefNamed flag definition
FlagsDefRecord of flag definitions
InferArgs<A>Infer resolved arg types from definitions
InferFlags<F>Infer resolved flag types from definitions
EffectiveFlags<I, L>Compute effective flags from inherited + local
InheritableFlags<F>Pick only inheritable flags
MergeFlags<P, L>Merge parent + local flags
ParseResult<A, F>Output of parseArgs
CommandRouteOutput of resolveCommand
CrustPluginPlugin interface
SetupContextContext passed to plugin setup hooks
SetupActionsActions available during plugin setup
MiddlewareContextContext passed to plugin middleware
PluginMiddlewareMiddleware function type
CrustErrorTyped error class
CrustErrorCodeError code union
ValueTypeSupported type literals ("string" | "number" | "boolean")
ValidateFlagAliases<F>Compile-time alias collision check
ValidateNoPrefixedFlags<F>Compile-time no- prefix check
ValidateVariadicArgs<A>Compile-time variadic position check

When to Use

@crustjs/core is the primary runtime dependency for all Crust CLI applications. Install it alongside @crustjs/plugins for official plugin support, and @crustjs/crust as a dev dependency for build tooling.

On this page