diff --git a/.changeset/cli-query-connections-patterns.md b/.changeset/cli-query-connections-patterns.md new file mode 100644 index 00000000..2c7cfab2 --- /dev/null +++ b/.changeset/cli-query-connections-patterns.md @@ -0,0 +1,10 @@ +--- +"@hyperdx/cli": minor +--- + +Add `hdx query` and `hdx connections` commands for agentic ClickHouse workflows: + +- **`hdx connections`** — list ClickHouse connections (`id`, `name`, `host`) for the authenticated team. Supports `--json` for programmatic consumption. +- **`hdx query --connection-id --sql `** — run raw SQL against a configured ClickHouse connection via the `/clickhouse-proxy`. Default `--format` is `JSONEachRow` (NDJSON); any ClickHouse format is accepted. Exit codes: `0` on success (empty stdout = zero rows), `1` on failure. On error, a lazy connection lookup distinguishes "unknown connection ID" from "bad SQL". +- **`hdx query --patterns`** — post-process the result with the Drain algorithm (`@hyperdx/common-utils/dist/drain`) and emit one NDJSON pattern object per cluster, sorted by count desc: `{"pattern":"