Function: defineCliSubcommand()
Makaio Framework / kernel/cli / defineCliSubcommand
Function: defineCliSubcommand()
Section titled “Function: defineCliSubcommand()”defineCliSubcommand<
T>(name,description,schema,handler):CliSubcommandEntry
Defined in: ../../../packages/kernel/src/cli/types.ts:197
Define a CLI subcommand with full type inference from schema to handler.
This is an identity function whose only purpose is to create a scope where
TypeScript infers T from schema and flows it into handler. No runtime
cost. Same pattern as Vite’s defineConfig() or Vue’s defineComponent().
Type Parameters
Section titled “Type Parameters”T extends ZodObject<Readonly<{[k: string]: $ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>; }>, $strip>
Parameters
Section titled “Parameters”string
Subcommand name.
description
Section titled “description”string
One-line description for help text.
schema
Section titled “schema”T
Zod object schema defining options/arguments.
handler
Section titled “handler”(ctx) => Promise<void>
Async handler receiving the typed CommandContext.
Returns
Section titled “Returns”A CliSubcommandEntry suitable for inclusion in a CliContribution.