Open Studio
Kit

Kit API

The kubb/kit reference for authoring plugins, generators, resolvers, renderers, adapters, parsers, and storage backends, plus the ast namespace, Diagnostics, the engine surface, and the testing helpers.

kubb/kit contains everything you need to build your own plugin and custom logic. Plugins, generators, resolvers, renderers, adapters, parsers, and storage backends all start here. It is a subpath of the top-level kubb package, so there is nothing extra to install. Import straight from kubb/kit.

Big concepts ​

The seven pieces you reach for when you build something new. Each has its own page.

ConceptEntry pointWhat it does
PluginsdefinePluginThe main extension point. Owns file naming, the output folder, and the lifecycle hooks.
GeneratorsdefineGeneratorWalks the AST and emits files. A plugin registers one or more.
ResolverscreateResolverDecides file names and output paths. Other plugins read them by name.
RendererscreateRenderer, jsxRendererTurns the elements a generator returns into FileNodes.
AdapterscreateAdapterConverts an input spec into the universal AST every plugin reads.
ParsersdefineParserTurns a FileNode into the source string written to disk.
StoragecreateStorage, fsStorage, memoryStorageDecides where generated files land.

Other parts ​

PartEntry pointWhat it does
AST and node buildersastThe namespace behind factory builders, visitors, guards, macros, and printers.
DiagnosticsDiagnosticsBuilds and narrows the structured errors Kubb collects during a build.
Engine and configurationdefineConfig, createKubbThe kubb-package surface that runs your plugins.
Lifecycle hooksKubbHooksEvery kubb:* hook a build fires, its payload, and when it fires.
Testingkubb/kit/testingVitest-backed helpers for testing plugins, generators, and adapters.

See also ​