Skip to content

chkit plugin

Lists registered plugins, lists a plugin’s commands, or runs a specific plugin command.

chkit plugin # list all plugins
chkit plugin <plugin-name> # list commands for a plugin
chkit plugin <plugin-name> <command> [args...] # run a plugin command

No command-specific flags. See global flags.

With no arguments, lists every registered plugin with its name, version, and available commands.

With a plugin name, lists the commands available for that plugin with their descriptions.

With both a plugin name and command name, executes the command. Any additional arguments are forwarded to the plugin command handler.

Some plugins have top-level CLI shortcuts:

  • chkit codegen is equivalent to chkit plugin codegen codegen
  • chkit pull is equivalent to chkit plugin pull schema

Plugins are registered in the plugins array of clickhouse.config.ts. Two registration styles are supported:

  1. Typed inline — import and call the plugin function directly:

    import { codegen } from '@chkit/plugin-codegen'
    plugins: [codegen({ outFile: './types.ts' })]
  2. Legacy path-based — specify a file path to resolve:

    plugins: [{ resolve: './plugins/my-plugin.ts', options: {} }]

Plugins can register hooks that run at various points in the CLI lifecycle:

  • onConfigLoaded — after config is parsed
  • onSchemaLoaded — after schema definitions are loaded (can modify definitions)
  • onPlanCreated — after migration plan is computed (can modify the plan)
  • onBeforeApply — before migration SQL is executed (can transform statements)
  • onAfterApply — after migration SQL is executed
  • onCheck — during chkit check evaluation
  • onCheckReport — for custom check result formatting

List all plugins:

Terminal window
chkit plugin

List commands for a specific plugin:

Terminal window
chkit plugin backfill

Run a plugin command:

Terminal window
chkit plugin backfill plan --target analytics.events --from 2025-01-01 --to 2025-02-01
CodeMeaning
0Success
1No plugins configured, or plugin/command not found
{
"command": "plugin",
"schemaVersion": 1,
"plugins": [
{
"name": "codegen",
"version": "1.0.0",
"commands": [
{ "name": "codegen", "description": "Generate TypeScript types" }
]
}
]
}
{
"command": "plugin",
"schemaVersion": 1,
"plugin": "backfill",
"commands": [
{ "name": "plan", "description": "Create a backfill plan" },
{ "name": "run", "description": "Execute a backfill plan" }
]
}