Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
cc95f88
Push python chkit port
Lucasgvdii Jun 5, 2026
323af3e
Merge branch 'main' into first-python-port
Lucasgvdii Jun 11, 2026
2b1b1b8
fix(obsessiondb): emit structured --json envelopes, never a bare string
Lucasgvdii Jun 24, 2026
24f825f
fix(pull): introspect through the host executor instead of a direct c…
Lucasgvdii Jun 24, 2026
5a07481
fix(migrate): keep polling async loads through transient gateway errors
Lucasgvdii Jun 24, 2026
bf0dcf2
fix(create-chkit): print "Next steps" once and honor --package-manager
Lucasgvdii Jun 24, 2026
efbf0f0
feat(cli): add a `chkit skills` proxy command
Lucasgvdii Jun 24, 2026
2f342f8
fix(init): show the connect runbook in non-TTY, surface plugin import…
Lucasgvdii Jun 24, 2026
6e725ce
fix(obsessiondb): logout reports "No active session" when there is none
Lucasgvdii Jun 24, 2026
beab71b
chore: add changesets for the onboarding/CLI fixes
Lucasgvdii Jun 24, 2026
7fe154a
fix(obsessiondb): make runnerFor module-private
Lucasgvdii Jun 24, 2026
2b08a9a
Merge branch 'fix/onboarding-cli-findings' into first-python-port
Lucasgvdii Jun 24, 2026
3941bc5
Update .gitignore
Lucasgvdii Jun 25, 2026
01e79bb
chore(.gitignore): trail-slash on .venv-dev/ to match other venv dirs
Lucasgvdii Jun 29, 2026
365eeb8
feat(chkit_python): add httpx + pytest-httpx for the obsessiondb HTTP…
Lucasgvdii Jun 29, 2026
eb7b4a8
feat(core): add config_path, plugin_error, schema_loader, ts_import m…
Lucasgvdii Jun 29, 2026
a3ae5ef
feat(core): expand public exports + audit fixes (primary_key fallback…
Lucasgvdii Jun 29, 2026
4fd6e4a
feat(clickhouse): ClickHouseClient + create-table parser + introspect…
Lucasgvdii Jun 29, 2026
555bdaa
feat(plugins): plugin contract types (hooks, commands, command contex…
Lucasgvdii Jun 29, 2026
7c1f315
feat(cli/runtime): plugin runtime, table scope, safety markers, journ…
Lucasgvdii Jun 29, 2026
842e1c6
feat(cli/init): chkit init command (scaffold + obsessiondb onboarding…
Lucasgvdii Jun 29, 2026
ad94a16
feat(cli/generate): chkit generate command + plan-pipeline + rename m…
Lucasgvdii Jun 29, 2026
cd02aa8
feat(cli/migrate): chkit migrate command + async-apply engine + promp…
Lucasgvdii Jun 29, 2026
893613b
feat(cli): chkit status + chkit drift commands
Lucasgvdii Jun 29, 2026
046f9de
feat(cli/check): chkit check command + TS-matching JSON envelope
Lucasgvdii Jun 29, 2026
12cfeea
feat(cli/pull): chkit pull command + view parser + render + on_pull_i…
Lucasgvdii Jun 29, 2026
5940531
feat(cli/query): chkit query command (ad-hoc SQL with text-table + JS…
Lucasgvdii Jun 29, 2026
a3ce86d
feat(cli/plugin): chkit plugin command dispatcher (list / inspect / run)
Lucasgvdii Jun 29, 2026
098705b
feat(cli): rt/user-config + rt/config-merge helpers
Lucasgvdii Jun 29, 2026
caf4499
feat(plugin-obsessiondb): full ObsessionDB plugin (foundation + auth …
Lucasgvdii Jun 29, 2026
3e51342
feat(plugin-codegen): emit Pydantic models from chkit schema definitions
Lucasgvdii Jun 29, 2026
b0cfd51
feat(plugin-backfill): Phase 1 skeleton (options + types + state + st…
Lucasgvdii Jun 29, 2026
e071c6f
test(parity-audit): 152 tests covering audit fixes + SQL render parity
Lucasgvdii Jun 29, 2026
d03bcc0
docs(chkit_python): DRIFT.md + PARITY-CHECKLIST.html + MISSING.md
Lucasgvdii Jun 29, 2026
4d08e8a
Merge branch 'main' into first-python-port
Lucasgvdii Jun 29, 2026
b47a110
feat(plugin-obsessiondb): versioned User-Agent (chkit/<version>) on e…
Lucasgvdii Jun 29, 2026
750588b
fix(plugin-obsessiondb): guard backfill plan/run/resume against selec…
Lucasgvdii Jun 29, 2026
9a4873f
feat(plugin-obsessiondb): shared json_envelope helpers + TS-shaped wh…
Lucasgvdii Jun 29, 2026
0d3bbec
test+docs(main-sync 2026-06-29): 14 tests for #M1-M3 + DRIFT.md narra…
Lucasgvdii Jun 29, 2026
fafeaca
Merge branch 'main' into first-python-port
Lucasgvdii Jul 28, 2026
198a971
Merge branch 'main' into first-python-port
Lucasgvdii Aug 10, 2026
c5840e2
feat(core): apply_on_cluster_to_plan + clickhouse.cluster config field
Lucasgvdii Aug 10, 2026
e221727
feat(cli): thread cluster through generate/migrate/status/check + rep…
Lucasgvdii Aug 10, 2026
70cff70
docs(drift): main sync 2026-07-02 — Category C: ON CLUSTER port
Lucasgvdii Aug 10, 2026
15e5c59
test(e2e): shared e2e_testkit helpers + rewire conftest
Lucasgvdii Aug 10, 2026
bde9016
docs: delete stale MISSING.md + PARITY-CHECKLIST.html
Lucasgvdii Aug 10, 2026
a5646f8
docs: delete stale PARITY.md + refresh README parity section
Lucasgvdii Aug 10, 2026
a1da58f
feat(chkit_python): full parity with TypeScript chkit
Lucasgvdii Aug 10, 2026
918a09f
docs: dual-language TS/Python docs + reposition as a toolkit for both
Lucasgvdii Aug 10, 2026
7e3aa9f
release(chkit-py): 0.2.0 — full TS parity + PyPI trusted-publishing w…
Lucasgvdii Aug 10, 2026
6b56c07
docs(drift): record declined edge-case findings from the Phase-2 revi…
Lucasgvdii Aug 10, 2026
26c7a66
chore(chkit-py): richer PyPI metadata — classifiers, urls, sharper de…
Lucasgvdii Aug 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cli-skills-proxy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chkit": patch
---

Add a `chkit skills` command that proxies to the external `skills` CLI (e.g. `chkit skills add obsessiondb/chkit` runs `npx skills add obsessiondb/chkit`). The agent skill is installed by the separate `skills` tool, not a chkit subcommand, so users who reached for `chkit skills add …` previously hit "Unknown command: skills". The command forwards its arguments and passes through the underlying exit code, and is handled before config loading so it works without a project.
6 changes: 6 additions & 0 deletions .changeset/create-chkit-next-steps-dedup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"create-chkit": patch
"@chkit/plugin-obsessiondb": patch
---

Print the "Next steps" block once and with the correct runner for the selected package manager. `create-chkit` previously printed it twice — once package-manager-aware and once from onboarding with a hardcoded `bunx` — so `--package-manager npm` users were told to run `bunx chkit …`. Onboarding now derives the runner (`npx` / `pnpm dlx` / `yarn dlx` / `bunx`) from the package manager, and `create-chkit` only prints its own next-steps when onboarding is skipped, removing the duplicate.
5 changes: 5 additions & 0 deletions .changeset/init-connect-runbook-consistency.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chkit": patch
---

Make `chkit init` consistent with `create-chkit` for connecting a database, and stop hiding plugin import failures. In a non-TTY shell `init` now prints the same connect runbook `create-chkit` does (when the obsessiondb plugin is installed) instead of silently skipping it; `--yes` still keeps init a silent file-writer for CI. The dynamic plugin import now only degrades silently when the plugin is genuinely not installed — any other load failure propagates instead of a false silent pass. The static next-steps also use `npx` rather than a hardcoded `bunx`.
5 changes: 5 additions & 0 deletions .changeset/migrate-async-poll-resilience.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chkit": patch
---

Keep polling an async data-load migration through transient gateway errors instead of aborting. A single HTTP 524 (or other transient failure) on a status-poll request no longer cancels the migration: the server-side query keeps running, so chkit tolerates a bounded number of poll errors and only gives up after the budget, with an explicit message that the load may still be running and that re-running re-attaches via the deterministic `query_id`. Only a real query exception, or a submit-time failure, is fatal. This affects only operations marked `mode=async` (data loads); ordinary schema DDL is synchronous and unaffected.
6 changes: 6 additions & 0 deletions .changeset/obsessiondb-json-no-bare-string.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@chkit/plugin-obsessiondb": patch
"chkit": patch
---

Make `--json` always emit a JSON object, never a bare JSON-encoded string. `printOutput` now wraps any plain string printed under `--json` in `{ schemaVersion, message }`, closing the whole class of bug at the serializer so no command can leak a bare string. `chkit obsessiondb whoami` gains a structured envelope (`status: logged_in | not_logged_in | session_expired`), and `chkit obsessiondb service list` emits a single object with a `services[]` array instead of one JSON line per service (which was not valid single-JSON). Previously these commands `JSON.stringify`'d a prose string (e.g. `"Not logged in…"`), breaking any pipe to `jq`. Text-mode output is unchanged. Note: this changes the `--json` output shape of `whoami` and `service list` from a string to an object.
5 changes: 5 additions & 0 deletions .changeset/obsessiondb-logout-no-session.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@chkit/plugin-obsessiondb": patch
---

`chkit obsessiondb logout` now reports "No active session." when there are no stored credentials, instead of always printing "Logged out." (which implied it had ended a session that never existed). Logout stays idempotent and exits 0 either way; only the message changes.
5 changes: 5 additions & 0 deletions .changeset/pull-route-through-executor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@chkit/plugin-pull": patch
---

Route `chkit pull` introspection through the host-provided executor instead of always opening its own ClickHouse connection. When an ObsessionDB service is selected, pull now introspects through the ObsessionDB API (the same executor `generate`/`migrate`/`status` use) rather than silently falling back to `http://localhost:8123` and failing with "connection refused" while printing `using service <name>`. A direct ClickHouse target is unchanged, custom introspectors still open their own raw connection, and a run with no reachable target now errors with an actionable message instead of a misleading localhost fallback.
66 changes: 66 additions & 0 deletions .github/workflows/publish-chkit-py.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Publish chkit-py to PyPI

# Publishes on tags like `chkit-py-v0.2.0` via PyPI trusted publishing (OIDC):
# no API tokens stored in the repo. One-time setup on pypi.org: project
# `chkit-py` → Publishing → add a trusted publisher for
# obsessiondb/chkit with workflow `publish-chkit-py.yml`.
on:
push:
tags:
- "chkit-py-v*"

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: chkit_python
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Verify tag matches package version
run: |
version=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
tag="${GITHUB_REF_NAME#chkit-py-v}"
if [ "$version" != "$tag" ]; then
echo "Tag $GITHUB_REF_NAME does not match pyproject version $version" >&2
exit 1
fi

- name: Build sdist and wheel
run: |
python -m pip install build twine
python -m build
python -m twine check dist/*

- name: Smoke-test the wheel
run: |
python -m venv /tmp/wheeltest
/tmp/wheeltest/bin/pip install dist/*.whl
/tmp/wheeltest/bin/python -c "import chkit, chkit_plugin_backfill, chkit_plugin_codegen, chkit_plugin_obsessiondb; print(chkit.__version__)"
/tmp/wheeltest/bin/chkit --version

- uses: actions/upload-artifact@v4
with:
name: chkit-py-dist
path: chkit_python/dist/

publish:
Comment on lines +14 to +52
needs: build
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: chkit-py-dist
path: dist/

- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

# chkit

**ClickHouse schema and migration CLI for TypeScript projects.**
**ClickHouse schema and migration toolkit for TypeScript and Python.**

[![npm version](https://img.shields.io/npm/v/chkit?label=npm)](https://www.npmjs.com/package/chkit)
[![CI](https://github.com/obsessiondb/chkit/actions/workflows/ci.yml/badge.svg)](https://github.com/obsessiondb/chkit/actions/workflows/ci.yml)
[![Docs](https://img.shields.io/badge/docs-chkit.obsessiondb.com-blue)](https://chkit.obsessiondb.com)

Define your ClickHouse tables, views, and materialized views in TypeScript. chkit diffs your schema, generates migration SQL, applies it safely, and keeps your dev and production databases in sync -- all from the command line.
Define your ClickHouse tables, views, materialized views, and dictionaries in TypeScript or Python. chkit diffs your schema, generates migration SQL, applies it safely, and keeps your dev and production databases in sync -- all from the command line.

> **Status: beta.** chkit powers production workloads and the CLI surface and schema DSL are stable. We may still make small breaking changes to UX and internal APIs before 1.0.

Expand Down Expand Up @@ -116,6 +116,10 @@ See the [configuration docs](https://chkit.obsessiondb.com/configuration/overvie
| [`@chkit/plugin-backfill`](packages/plugin-backfill) | Backfill plugin for data migrations |
| [`@chkit/plugin-obsessiondb`](packages/plugin-obsessiondb) | ObsessionDB integration: auto-rewrite `Shared` engines for ClickHouse targets |

## Python

chkit is also available for Python as [`chkit-py`](https://pypi.org/project/chkit-py/) (`pip install chkit-py`) — same CLI, same schema semantics, with config and schema files written as `.py`. The port lives in [`chkit_python/`](chkit_python).

## Documentation

Full documentation is available at **[chkit.obsessiondb.com](https://chkit.obsessiondb.com)**.
Expand Down
4 changes: 4 additions & 0 deletions apps/docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ export default defineConfig({
label: 'Plugins',
autogenerate: { directory: 'plugins' },
},
{
label: 'Python',
autogenerate: { directory: 'python' },
},
{
label: 'CLI Reference',
autogenerate: { directory: 'cli' },
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/src/components/Footer.astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const repo = 'https://github.com/obsessiondb/chkit';
<div class="chk-site-footer-inner">
<div class="chk-footer-brand">
<a href="/" class="chk-wordmark chk-footer-wordmark"><span translate="no">ch-kit</span></a>
<p class="chk-footer-tagline">Headless TypeScript O(A)RM for ClickHouse!</p>
<p class="chk-footer-tagline">Headless O(A)RM for ClickHouse — TypeScript & Python!</p>
<div class="chk-footer-social">
<a href={repo} target="_blank" rel="noopener noreferrer" aria-label="GitHub">
<svg viewBox="0 0 16 16" fill="currentColor" aria-hidden="true">
Expand Down Expand Up @@ -47,7 +47,7 @@ const repo = 'https://github.com/obsessiondb/chkit';
<p class="chk-footer-col-title">Ports</p>
<ul>
<li><a href="https://npmx.dev/org/chkit" target="_blank" rel="noopener noreferrer">TypeScript</a></li>
<li><span class="chk-footer-soon">Python (coming soon)</span></li>
<li><a href="https://pypi.org/project/chkit-py/" target="_blank" rel="noopener noreferrer">Python (chkit-py)</a></li>
</ul>
</div>
</div>
Expand Down
5 changes: 2 additions & 3 deletions apps/docs/src/components/Hero.astro
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

<div class="hero">
{
darkImage && (

Check failure on line 41 in apps/docs/src/components/Hero.astro

View workflow job for this annotation

GitHub Actions / verify

High CRAP score (critical)

Function '<template>' has a CRAP score of 110.0 (threshold: 30.0). • Severity: critical • Cyclomatic: 10 • Cognitive: 7 • CRAP: 110.0 (threshold: 30.0) • Lines: 211 CRAP combines complexity with coverage: high CRAP means changes here carry high risk. Consider adding tests, simplifying the function, or both.
<Image
src={darkImage}
{...imageAttrs}
Expand Down Expand Up @@ -75,7 +75,7 @@
TypeScript
</a>
<a
class="chk-badge chk-badge--soon"
class="chk-badge"
href="https://pypi.org/project/chkit-py/"
target="_blank"
rel="noopener noreferrer"
Expand Down Expand Up @@ -117,8 +117,7 @@
/>
</svg>
Python
<span class="chk-badge-soon">Coming soon</span>
</a>
</a>
</div>
</div>
{
Expand Down
7 changes: 4 additions & 3 deletions apps/docs/src/content/docs/ai-agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Every docs page is available as raw Markdown by appending `.md` to its URL — t

## What chkit is

chkit is a ClickHouse schema and migration toolkit for TypeScript. Schemas are defined in TypeScript, diffed into migration SQL, applied to ClickHouse, and verified against the live database.
chkit is a ClickHouse schema and migration toolkit for TypeScript and Python. Schemas are defined in TypeScript or Python, diffed into migration SQL, applied to ClickHouse, and verified against the live database.

You drive chkit with shell commands, plus an installable agent skill that loads its full command surface, schema DSL, and workflows into your context.

Expand All @@ -34,6 +34,7 @@ chkit's interactive CLI asks these questions when a human runs it. You run it no
1. **New project or existing project?**
- *New / empty directory* → scaffold from a curated example with `create-chkit` (Step 3a).
- *Existing TypeScript project* → install chkit and run `chkit init` in place (Step 3b).
- *Existing Python project* → `pip install chkit-py`, then `chkit init` in place (config and schema are written as `.py` files; plugins ship inside chkit-py).

2. **Is there an existing ClickHouse database with tables to manage?**
- *Yes* → add [`@chkit/plugin-pull`](/plugins/pull/) and introspect the live tables into schema files, so the user starts from real tables instead of the blank example (Step 5).
Expand Down Expand Up @@ -130,12 +131,12 @@ chkit check # CI gate: pending, checksums, drift, plugins

## Which plugins to recommend

Plugins are npm packages registered in the `plugins` array of `clickhouse.config.ts`. Recommend only what the project needs:
In TypeScript, plugins are npm packages registered in the `plugins` array of `clickhouse.config.ts`; in Python they ship inside chkit-py and are registered in `clickhouse.config.py`. Recommend only what the project needs:

| If the project needs to... | Recommend | Notes |
|----------------------------|-----------|-------|
| Adopt chkit on an **existing** ClickHouse database | [`@chkit/plugin-pull`](/plugins/pull/) | Introspects the live database into local schema files so the user starts from real tables, not a blank example. |
| Generate **TypeScript types** (and optional Zod schemas) from the schema | [`@chkit/plugin-codegen`](/plugins/codegen/) | Keeps application row types in sync with the schema definitions. |
| Generate **typed row models** — TypeScript types (and optional Zod schemas), or Pydantic models in Python — from the schema | [`@chkit/plugin-codegen`](/plugins/codegen/) | Keeps application row types in sync with the schema definitions. |
| **Backfill** historical data into materialized views | [`@chkit/plugin-backfill`](/plugins/backfill/) | Time-windowed loads with checkpoints, for large or resumable backfills. |
| Deploy to **ObsessionDB** | [`@chkit/plugin-obsessiondb`](/obsessiondb/overview/) | First-class ObsessionDB integration; rewrites `Shared` engines when targeting non-ObsessionDB ClickHouse. |

Expand Down
4 changes: 2 additions & 2 deletions apps/docs/src/content/docs/cli/codegen.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
title: "chkit codegen"
description: "Generate TypeScript types, ingestion functions, and runtime migration modules from schema definitions."
description: "Generate typed row models (TypeScript types or Pydantic models), plus TypeScript-only ingestion functions and runtime migration modules from schema definitions."
sidebar:
order: 9
---

Shortcut for `chkit plugin codegen codegen`. Generates TypeScript row types, optional Zod schemas, ingestion functions, and runtime migration modules from your schema definitions.
Shortcut for `chkit plugin codegen codegen`. Generates TypeScript row types, optional Zod schemas (in Python: Pydantic models), ingestion functions, and runtime migration modules from your schema definitions.

## Synopsis

Expand Down
4 changes: 2 additions & 2 deletions apps/docs/src/content/docs/cli/generate.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sidebar:
order: 3
---

Compares your current TypeScript schema definitions against the previous snapshot, computes a migration plan, and writes migration SQL and an updated snapshot.
Compares your current schema definitions against the previous snapshot, computes a migration plan, and writes migration SQL and an updated snapshot.

## Synopsis

Expand Down Expand Up @@ -217,4 +217,4 @@ chkit generate --rename-dictionary old_db.old_dict=new_db.new_dict
- [The migration workflow](/guides/migration-workflow/) — why generate is offline, and what to commit alongside the SQL
- [`chkit init`](/cli/init/) — scaffold a project before your first generate
- [`chkit migrate`](/cli/migrate/) — apply generated migrations to ClickHouse
- [`chkit codegen`](/cli/codegen/) — manually trigger TypeScript type generation
- [`chkit codegen`](/cli/codegen/) — manually trigger type generation
2 changes: 2 additions & 0 deletions apps/docs/src/content/docs/cli/init.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Writes two files relative to the current working directory, leaving any that alr
1. **`clickhouse.config.ts`** — project config with sensible defaults: `schema: './src/db/schema/**/*.ts'`, `outDir: './chkit'`, `migrationsDir: './chkit/migrations'`, `metaDir: './chkit/meta'`, an empty `plugins` array, and a `clickhouse` block reading from `CLICKHOUSE_URL`, `CLICKHOUSE_USER`, `CLICKHOUSE_PASSWORD`, and `CLICKHOUSE_DB`.
2. **`src/db/schema/example.ts`** — a starter `MergeTree` table named `events` with columns `id` (`UInt64`), `source` (`String`), and `ingested_at` (`DateTime64(3)`).

Under [chkit-py](/python/overview/), the same command writes `clickhouse.config.py` and `src/db/schema/example.py` instead.

### 2. Install dependencies

If `@chkit/core` does not already resolve from the project, `init` makes the project runnable: it writes a minimal `package.json` when none exists, then installs `chkit`, `@chkit/core`, and `@chkit/plugin-obsessiondb` as dev dependencies using the detected package manager (`npm`, `pnpm`, `yarn`, or `bun`; defaults to `bun`). This is why `init` works in a brand-new empty folder, not just an existing project. A failed install never aborts `init` — it prints the manual install command and continues.
Expand Down
8 changes: 4 additions & 4 deletions apps/docs/src/content/docs/cli/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sidebar:
import { Image } from 'astro:assets';
import commandConnections from '../../../assets/command-connections.png';

The `chkit` CLI manages ClickHouse schemas, migrations, drift detection, and CI checks from the command line. It follows a workflow-oriented design: define your schema in TypeScript, generate migrations, apply them, and verify everything stays in sync.
The `chkit` CLI manages ClickHouse schemas, migrations, drift detection, and CI checks from the command line. It follows a workflow-oriented design: define your schema in TypeScript or Python, generate migrations, apply them, and verify everything stays in sync.

## Commands

Expand All @@ -21,8 +21,8 @@ The `chkit` CLI manages ClickHouse schemas, migrations, drift detection, and CI
| [`chkit drift`](/cli/drift/) | Compare snapshot against live ClickHouse and report differences |
| [`chkit check`](/cli/check/) | Run policy checks for CI gates (pending, checksums, drift, plugins) |
| [`chkit query`](/cli/query/) | Run an ad-hoc SQL query against the configured target |
| [`chkit pull`](/cli/pull/) | Introspect live ClickHouse and generate a TypeScript schema file |
| [`chkit codegen`](/cli/codegen/) | Generate TypeScript types from schema definitions |
| [`chkit pull`](/cli/pull/) | Introspect live ClickHouse and generate a schema file |
| [`chkit codegen`](/cli/codegen/) | Generate typed row models from schema definitions |
| [`chkit plugin`](/cli/plugin/) | List or run plugin commands |

## Connection requirements
Expand Down Expand Up @@ -51,7 +51,7 @@ These flags are available on every command that loads a config file:

| Flag | Type | Default | Description |
|------|------|---------|-------------|
| `--config <path>` | string | `clickhouse.config.ts` | Path to the chkit config file |
| `--config <path>` | string | `clickhouse.config.ts` / `clickhouse.config.py` | Path to the chkit config file |
| `--json` | boolean | `false` | Emit machine-readable JSON output |
| `--table <selector>` | string | — | Narrow some commands to matching tables (exact name or trailing wildcard prefix, e.g. `events_*`). Effect varies per command — see note below |
| `--help` | boolean | — | Show help text |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ sidebar:
order: 11
---

import { Tabs, TabItem } from '@astrojs/starlight/components';

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

## Synopsis
Expand Down Expand Up @@ -38,17 +40,28 @@ With both a plugin name and command name, executes the command. Any additional a
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`
- `chkit pull` is equivalent to `chkit plugin pull schema` (TypeScript; in Python `pull` is a built-in command with no plugin behind it)

### Plugin registration

Plugins are registered inline in the `plugins` array of `clickhouse.config.ts`:
Plugins are registered inline in the `plugins` array of your config:

```ts
import { codegen } from '@chkit/plugin-codegen'
<Tabs syncKey="lang">
<TabItem label="TypeScript">
```ts
import { codegen } from '@chkit/plugin-codegen'

plugins: [codegen({ outFile: './types.ts' })]
```
plugins: [codegen({ outFile: './types.ts' })]
```
</TabItem>
<TabItem label="Python">
```python
from chkit_plugin_codegen import codegen

"plugins": [codegen({"outFile": "./models.py"})]
```
</TabItem>
</Tabs>

### Plugin lifecycle hooks

Expand Down
4 changes: 2 additions & 2 deletions apps/docs/src/content/docs/cli/pull.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
title: "chkit pull"
description: "Introspect live ClickHouse and generate a TypeScript schema file."
description: "Introspect live ClickHouse and generate a schema file."
sidebar:
order: 8
---

Shortcut for `chkit plugin pull schema`. Introspects your live ClickHouse instance and generates a deterministic TypeScript schema file.
Shortcut for `chkit plugin pull schema`. Introspects your live ClickHouse instance and generates a deterministic schema file (TypeScript, or Python under chkit-py).

## Synopsis

Expand Down
Loading
Loading