chkit plugin
Lists registered plugins, lists a plugin’s commands, or runs a specific plugin command.
Synopsis
Section titled “Synopsis”chkit plugin # list all pluginschkit plugin <plugin-name> # list commands for a pluginchkit plugin <plugin-name> <command> [args...] # run a plugin commandNo command-specific flags. See global flags.
Behavior
Section titled “Behavior”List all plugins
Section titled “List all plugins”With no arguments, lists every plugin registered in your config (and the ObsessionDB plugin a login adds), in config order, with its name, version, and available commands. chkit’s built-in commands are not plugins and are not listed. With no plugin registered, it fails with exit code 1.
Configured plugins:- codegen (v1.0.0) - codegen: Generate TypeScript typesList plugin commands
Section titled “List plugin commands”With a plugin name, lists the commands available for that plugin with their descriptions.
Plugin commands for "backfill":- plan: Create a backfill plan- run: Execute a backfill planRun a plugin command
Section titled “Run a plugin command”With both a plugin name and command name, executes the command. The remaining arguments are forwarded to it: the flags the command declares are parsed into its flags, and the other arguments are its positional args. An undeclared flag is an error. Everything after -- is a positional, even when it starts with -:
chkit plugin my-plugin echo --name ada -- --not-a-flagA command that takes no positional arguments declares it with takesArgs: false (Python: takes_args=False). chkit then rejects any argument given to it, before or after --, as it does for its own commands: Got unexpected extra argument(s) (<args>) on stderr, exit code 1, and with --json the error envelope with code usage on stdout. The command does not run, and neither do the onInit and onComplete hooks. A command that leaves it unset gets its arguments in args. The built-in plugins declare it on every command that reads no arguments, such as chkit obsessiondb login, so chkit obsessiondb login -- -h fails instead of logging in.
commands: [ { name: 'sync', description: 'Sync now', takesArgs: false, run: runSync },]commands=[ ChxPluginCommand(name="sync", description="Sync now", run=run_sync, takes_args=False),]Errors
Section titled “Errors”An unknown plugin fails with exit code 1 and Unknown plugin "<name>". Available: <plugins>. on stderr; with --json, stdout holds the error envelope with code error. An unknown command of a configured plugin prints Unknown <plugin> command "<command>". Available: <commands>. on stderr and exits 1; with --json, stdout holds {"command": "plugin", "schemaVersion": 1, "ok": false, "error": "<message>"} instead. The TypeScript list of plugins also names its built-in plugins (core, @chkit/internal-skill-hint).
CLI shortcuts
Section titled “CLI shortcuts”Some plugins have top-level CLI shortcuts:
chkit codegenis equivalent tochkit plugin codegen codegenchkit pullis equivalent tochkit plugin pull schema. Both run the installed pull plugin with its defaults whenconfig.pluginsdoes not register it (in Pythonpullis a built-in command with no plugin behind it)chkit obsessiondb <command>is equivalent tochkit plugin obsessiondb <command>
In the TypeScript CLI, a plugin’s commands can also be called as chkit <plugin-name> <command> [args...]. A shortcut gives the command the same args as its chkit plugin form: the positionals after the command name, without the name itself.
Plugin registration
Section titled “Plugin registration”Plugins are registered inline in the plugins array of your config. Python support is in beta; see the Python overview.
import { codegen } from '@chkit/plugin-codegen'
plugins: [codegen({ outFile: './types.ts' })]from chkit_plugin_codegen import codegen
"plugins": [codegen({"outFile": "./models.py"})]Plugin lifecycle hooks
Section titled “Plugin lifecycle hooks”Plugins can register hooks that run at various points in the CLI lifecycle:
onConfigLoaded— after config is parsedonSchemaLoaded— after schema definitions are loaded (can modify definitions); runs forgenerateandsnapshot rebuild, so both write the same snapshotonSnapshotLoaded— ingenerate, on the previous snapshot’s definitions before they are compared with the schema (can modify definitions). A plugin that rewrites the schema inonSchemaLoadedapplies the same rewrite here, so a snapshot written before the rewrite existed plans no changeonPlanCreated— after migration plan is computed (can modify the plan)onBeforeApply— before migration SQL is executed (can transform statements)onAfterApply— after migration SQL is executedonCheck— duringchkit checkevaluationonCheckReport— for custom check result formatting
onConfigLoaded and onSchemaLoaded receive the running command as context.command. During chkit snapshot rebuild it is snapshot; a hook that rewrites definitions only when the command is generate makes the rebuilt snapshot differ from the one generate writes.
Examples
Section titled “Examples”List all plugins:
chkit pluginList commands for a specific plugin:
chkit plugin backfillRun a plugin command:
chkit plugin backfill plan --target analytics.events --from 2025-01-01 --to 2025-02-01Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | No plugins configured, plugin/command not found, or an argument given to a command that takes none |
JSON output
Section titled “JSON output”List all plugins
Section titled “List all plugins”{ "command": "plugin", "schemaVersion": 1, "plugins": [ { "name": "codegen", "version": "1.0.0", "commands": [ { "name": "codegen", "description": "Generate TypeScript types" } ] } ]}List plugin commands
Section titled “List plugin commands”{ "command": "plugin", "schemaVersion": 1, "plugin": "backfill", "commands": [ { "name": "plan", "description": "Create a backfill plan" }, { "name": "run", "description": "Execute a backfill plan" } ]}No plugins configured
Section titled “No plugins configured”Exit code 1. Text mode prints No plugins configured. Add entries to config.plugins first. on stderr; --json prints:
{ "command": "plugin", "schemaVersion": 1, "error": "No plugins configured. Add entries to config.plugins first.", "plugins": []}