Spec for items 1, 2, 4, 5: docs/cli-spec.md
- CLI (
chfx) usable by agent — implemented (branchcli-foundation-decode, with item 4). npm bin via Node/tsx, publish-ready (esbuild bundle);npm linkfor a PATHchfx. Deterministic JSON on stdout, JSON error envelope on stderr, non-interactive, self-describing. Commands:decode,query,capture+--help/--version. (A standaloneschemacommand was dropped —--help+ self-describing output suffice for now.) - Configurable server version in the image — done (#42).
ARG CH_VERSION→FROM clickhouse/clickhouse-server:${CH_VERSION}, surfaced via docker-compose. Configurable protocol version in TCP + native web interface— dropped (clickhouse-client can't force the negotiated version; HTTP selector suffices).- Import binary dump in CLI → structured output — implemented (with item 1).
chfx decode: autodetect.chproto/Native/RowBinary with--formatoverride, stdin supported. Emits the webParsedData/AstNodeJSON; top-levelbytesHex(whole buffer once) plus per-node inlinebytesby default (--no-node-bytesto omit).- UX one-shot (implemented):
chfx query --query "<sql>"runs and decodes in one step — no intermediate file.--protocol tcp(default) captures via clickhouse-client;--protocol httpPOSTs and decodes the--format(native | RowBinaryWithNamesAndTypes) body.--savekeeps the dump (tcp).chfx capturewrites a dump (file or raw stdout);npm run capturealiases it.
- UX one-shot (implemented):
- Use with external clients, in the CLI — implemented (branch
chfx-proxy).chfx proxy --listen <[host:]port> --target <host:port>: a capturing TCP proxy any native client connects through (the proxy never spawns one). Single-shot by default (--out <file>,--decode, or raw dump to stdout, then exit);--persistentserves many connections (--save-dirone dump per connection,--decodestreams JSON per connection) until Ctrl-C. Plaintext/uncompressed only. Backed bystartCaptureProxyinscripts/native-proxy.mjs.
Cross-cutting: thorough CLI tests/fixtures; README quick-start + full options reference; remote auth/TLS flags. (Native own-TCP-client to drop the clickhouse-client dependency: considered, shelved for now.)
- Deploy similar to play.clickhouse.com?