You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2026/05/29 03:45:36 UTC

(doris-cli) 01/01: Initial: Apache Doris Cli Co-Authored-By: tomz-alt

This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/doris-cli.git

commit 61e2809f41091e6e104e34613412547b72df2022
Author: Mingyu Chen (Rayner) <yu...@selectdb.com>
AuthorDate: Fri May 29 11:35:21 2026 +0800

    Initial: Apache Doris Cli
    Co-Authored-By: tomz-alt <he...@gmail.com>
---
 .gitignore                         |    1 +
 Cargo.lock                         | 3579 ++++++++++++++++++++++++++++++++++++
 Cargo.toml                         |   49 +
 LICENSE.txt                        |  202 ++
 README.md                          |  217 +++
 config/products.toml               |    5 +
 src/cli/auth.rs                    |   58 +
 src/cli/mod.rs                     |    7 +
 src/cli/profile.rs                 |   74 +
 src/cli/root.rs                    |   62 +
 src/cli/sql.rs                     |   23 +
 src/cli/tablet.rs                  |   15 +
 src/commands/auth.rs               |  284 +++
 src/commands/mod.rs                |    5 +
 src/commands/profile/diff.rs       |  123 ++
 src/commands/profile/fetch.rs      |  188 ++
 src/commands/profile/full.rs       |  277 +++
 src/commands/profile/history.rs    |  152 ++
 src/commands/profile/list.rs       |   88 +
 src/commands/profile/mod.rs        |   51 +
 src/commands/profile/summary.rs    |  530 ++++++
 src/commands/sql.rs                |   45 +
 src/commands/tablet/detail.rs      |  170 ++
 src/commands/tablet/mod.rs         |   14 +
 src/commands/tablet/overview.rs    |  288 +++
 src/commands/use_env.rs            |   67 +
 src/config/environment.rs          |  159 ++
 src/config/mod.rs                  |    5 +
 src/config/store.rs                |  269 +++
 src/connection/http.rs             |  290 +++
 src/connection/mod.rs              |    6 +
 src/connection/mysql.rs            |  156 ++
 src/connection/socks5_forwarder.rs |   87 +
 src/error.rs                       |   90 +
 src/main.rs                        |  107 ++
 src/models/load.rs                 |    2 +
 src/models/mod.rs                  |    4 +
 src/models/profile.rs              |  238 +++
 src/models/sql.rs                  |    3 +
 src/models/tablet.rs               |    3 +
 src/output/csv.rs                  |   58 +
 src/output/format.rs               |   31 +
 src/output/json.rs                 |    8 +
 src/output/mod.rs                  |   16 +
 src/output/table.rs                |   96 +
 src/parser/fragment_parser.rs      |  319 ++++
 src/parser/mod.rs                  |    5 +
 src/parser/operator_parser.rs      |  105 ++
 src/parser/profile_parser.rs       |  308 ++++
 src/parser/section_parser.rs       |   98 +
 src/parser/value_parser.rs         |  151 ++
 src/product.rs                     |   34 +
 52 files changed, 9222 insertions(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e43b0f9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.DS_Store
diff --git a/Cargo.lock b/Cargo.lock
new file mode 100644
index 0000000..883d554
--- /dev/null
+++ b/Cargo.lock
@@ -0,0 +1,3579 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 4
+
+[[package]]
+name = "adler2"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
+
+[[package]]
+name = "ahash"
+version = "0.7.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9"
+dependencies = [
+ "getrandom 0.2.17",
+ "once_cell",
+ "version_check",
+]
+
+[[package]]
+name = "aho-corasick"
+version = "1.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "allocator-api2"
+version = "0.2.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
+
+[[package]]
+name = "anstream"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d"
+dependencies = [
+ "anstyle",
+ "anstyle-parse",
+ "anstyle-query",
+ "anstyle-wincon",
+ "colorchoice",
+ "is_terminal_polyfill",
+ "utf8parse",
+]
+
+[[package]]
+name = "anstyle"
+version = "1.0.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"
+
+[[package]]
+name = "anstyle-parse"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e"
+dependencies = [
+ "utf8parse",
+]
+
+[[package]]
+name = "anstyle-query"
+version = "1.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
+dependencies = [
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "anstyle-wincon"
+version = "3.0.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"
+dependencies = [
+ "anstyle",
+ "once_cell_polyfill",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "anyhow"
+version = "1.0.102"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
+
+[[package]]
+name = "arrayvec"
+version = "0.7.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
+
+[[package]]
+name = "ascii"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16"
+
+[[package]]
+name = "assert_cmd"
+version = "2.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2aa3a22042e45de04255c7bf3626e239f450200fd0493c1e382263544b20aea6"
+dependencies = [
+ "anstyle",
+ "bstr",
+ "libc",
+ "predicates",
+ "predicates-core",
+ "predicates-tree",
+ "wait-timeout",
+]
+
+[[package]]
+name = "atomic-waker"
+version = "1.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
+
+[[package]]
+name = "autocfg"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
+
+[[package]]
+name = "base64"
+version = "0.21.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
+
+[[package]]
+name = "base64"
+version = "0.22.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
+
+[[package]]
+name = "bigdecimal"
+version = "0.4.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4d6867f1565b3aad85681f1015055b087fcfd840d6aeee6eee7f2da317603695"
+dependencies = [
+ "autocfg",
+ "libm",
+ "num-bigint",
+ "num-integer",
+ "num-traits",
+]
+
+[[package]]
+name = "bindgen"
+version = "0.72.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"
+dependencies = [
+ "bitflags",
+ "cexpr",
+ "clang-sys",
+ "itertools",
+ "proc-macro2",
+ "quote",
+ "regex",
+ "rustc-hash",
+ "shlex",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "bitflags"
+version = "2.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3"
+
+[[package]]
+name = "bitvec"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c"
+dependencies = [
+ "funty",
+ "radium",
+ "tap",
+ "wyz",
+]
+
+[[package]]
+name = "block-buffer"
+version = "0.10.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
+dependencies = [
+ "generic-array",
+]
+
+[[package]]
+name = "borsh"
+version = "1.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cfd1e3f8955a5d7de9fab72fc8373fade9fb8a703968cb200ae3dc6cf08e185a"
+dependencies = [
+ "borsh-derive",
+ "bytes",
+ "cfg_aliases",
+]
+
+[[package]]
+name = "borsh-derive"
+version = "1.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bfcfdc083699101d5a7965e49925975f2f55060f94f9a05e7187be95d530ca59"
+dependencies = [
+ "once_cell",
+ "proc-macro-crate",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "bstr"
+version = "1.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "63044e1ae8e69f3b5a92c736ca6269b8d12fa7efe39bf34ddb06d102cf0e2cab"
+dependencies = [
+ "memchr",
+ "regex-automata",
+ "serde",
+]
+
+[[package]]
+name = "btoi"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9dd6407f73a9b8b6162d8a2ef999fe6afd7cc15902ebf42c5cd296addf17e0ad"
+dependencies = [
+ "num-traits",
+]
+
+[[package]]
+name = "bumpalo"
+version = "3.20.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
+
+[[package]]
+name = "bytecheck"
+version = "0.6.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "23cdc57ce23ac53c931e88a43d06d070a6fd142f2617be5855eb75efc9beb1c2"
+dependencies = [
+ "bytecheck_derive",
+ "ptr_meta",
+ "simdutf8",
+]
+
+[[package]]
+name = "bytecheck_derive"
+version = "0.6.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "byteorder"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
+
+[[package]]
+name = "bytes"
+version = "1.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33"
+
+[[package]]
+name = "cc"
+version = "1.2.62"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a1dce859f0832a7d088c4f1119888ab94ef4b5d6795d1ce05afb7fe159d79f98"
+dependencies = [
+ "find-msvc-tools",
+ "jobserver",
+ "libc",
+ "shlex",
+]
+
+[[package]]
+name = "cexpr"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
+dependencies = [
+ "nom",
+]
+
+[[package]]
+name = "cfg-if"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
+
+[[package]]
+name = "cfg_aliases"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
+
+[[package]]
+name = "chunked_transfer"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6e4de3bc4ea267985becf712dc6d9eed8b04c953b3fcfb339ebc87acd9804901"
+
+[[package]]
+name = "clang-sys"
+version = "1.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
+dependencies = [
+ "glob",
+ "libc",
+ "libloading",
+]
+
+[[package]]
+name = "clap"
+version = "4.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51"
+dependencies = [
+ "clap_builder",
+ "clap_derive",
+]
+
+[[package]]
+name = "clap_builder"
+version = "4.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f"
+dependencies = [
+ "anstream",
+ "anstyle",
+ "clap_lex",
+ "strsim",
+]
+
+[[package]]
+name = "clap_derive"
+version = "4.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9"
+dependencies = [
+ "heck",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "clap_lex"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9"
+
+[[package]]
+name = "cmake"
+version = "0.1.58"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678"
+dependencies = [
+ "cc",
+]
+
+[[package]]
+name = "colorchoice"
+version = "1.0.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570"
+
+[[package]]
+name = "comfy-table"
+version = "7.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4a65ebfec4fb190b6f90e944a817d60499ee0744e582530e2c9900a22e591d9a"
+dependencies = [
+ "crossterm",
+ "unicode-segmentation",
+ "unicode-width",
+]
+
+[[package]]
+name = "core-foundation"
+version = "0.9.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
+[[package]]
+name = "core-foundation"
+version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
+[[package]]
+name = "core-foundation-sys"
+version = "0.8.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
+
+[[package]]
+name = "cpufeatures"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "crc32fast"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "crossbeam"
+version = "0.8.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1137cd7e7fc0fb5d3c5a8678be38ec56e819125d8d7907411fe24ccb943faca8"
+dependencies = [
+ "crossbeam-channel",
+ "crossbeam-deque",
+ "crossbeam-epoch",
+ "crossbeam-queue",
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "crossbeam-channel"
+version = "0.5.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2"
+dependencies = [
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "crossbeam-deque"
+version = "0.8.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51"
+dependencies = [
+ "crossbeam-epoch",
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "crossbeam-epoch"
+version = "0.9.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
+dependencies = [
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "crossbeam-queue"
+version = "0.3.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115"
+dependencies = [
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "crossbeam-utils"
+version = "0.8.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
+
+[[package]]
+name = "crossterm"
+version = "0.28.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6"
+dependencies = [
+ "bitflags",
+ "crossterm_winapi",
+ "parking_lot",
+ "rustix 0.38.44",
+ "winapi",
+]
+
+[[package]]
+name = "crossterm_winapi"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b"
+dependencies = [
+ "winapi",
+]
+
+[[package]]
+name = "crypto-common"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
+dependencies = [
+ "generic-array",
+ "typenum",
+]
+
+[[package]]
+name = "darling"
+version = "0.20.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee"
+dependencies = [
+ "darling_core",
+ "darling_macro",
+]
+
+[[package]]
+name = "darling_core"
+version = "0.20.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e"
+dependencies = [
+ "fnv",
+ "ident_case",
+ "proc-macro2",
+ "quote",
+ "strsim",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "darling_macro"
+version = "0.20.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead"
+dependencies = [
+ "darling_core",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "deranged"
+version = "0.5.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c"
+dependencies = [
+ "powerfmt",
+]
+
+[[package]]
+name = "difflib"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8"
+
+[[package]]
+name = "digest"
+version = "0.10.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
+dependencies = [
+ "block-buffer",
+ "crypto-common",
+]
+
+[[package]]
+name = "dirs"
+version = "5.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
+dependencies = [
+ "dirs-sys",
+]
+
+[[package]]
+name = "dirs-sys"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c"
+dependencies = [
+ "libc",
+ "option-ext",
+ "redox_users",
+ "windows-sys 0.48.0",
+]
+
+[[package]]
+name = "displaydoc"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1ac70aa55017e108007fbaf5aa0f54b021c98f92ff8af59d42eda9da96e3dd4f"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "doriscli"
+version = "0.3.8"
+dependencies = [
+ "anyhow",
+ "assert_cmd",
+ "clap",
+ "comfy-table",
+ "dirs",
+ "is-terminal",
+ "mysql_async",
+ "once_cell",
+ "openssl",
+ "predicates",
+ "regex",
+ "reqwest",
+ "serde",
+ "serde_json",
+ "tempfile",
+ "thiserror 2.0.18",
+ "time",
+ "tiny_http",
+ "tokio",
+ "tokio-socks",
+ "toml",
+ "tracing",
+ "tracing-subscriber",
+]
+
+[[package]]
+name = "either"
+version = "1.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e"
+
+[[package]]
+name = "encoding_rs"
+version = "0.8.35"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "equivalent"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
+
+[[package]]
+name = "errno"
+version = "0.3.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
+dependencies = [
+ "libc",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "fastrand"
+version = "2.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6"
+
+[[package]]
+name = "find-msvc-tools"
+version = "0.1.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
+
+[[package]]
+name = "flate2"
+version = "1.1.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c"
+dependencies = [
+ "crc32fast",
+ "libz-sys",
+ "miniz_oxide",
+]
+
+[[package]]
+name = "float-cmp"
+version = "0.10.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b09cf3155332e944990140d967ff5eceb70df778b34f77d8075db46e4704e6d8"
+dependencies = [
+ "num-traits",
+]
+
+[[package]]
+name = "fnv"
+version = "1.0.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
+
+[[package]]
+name = "foldhash"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
+
+[[package]]
+name = "foreign-types"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
+dependencies = [
+ "foreign-types-shared",
+]
+
+[[package]]
+name = "foreign-types-shared"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
+
+[[package]]
+name = "form_urlencoded"
+version = "1.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
+dependencies = [
+ "percent-encoding",
+]
+
+[[package]]
+name = "frunk"
+version = "0.4.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "28aef0f9aa070bce60767c12ba9cb41efeaf1a2bc6427f87b7d83f11239a16d7"
+dependencies = [
+ "frunk_core",
+ "frunk_derives",
+ "frunk_proc_macros",
+ "serde",
+]
+
+[[package]]
+name = "frunk_core"
+version = "0.4.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "476eeaa382e3462b84da5d6ba3da97b5786823c2d0d3a0d04ef088d073da225c"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "frunk_derives"
+version = "0.4.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a0b4095fc99e1d858e5b8c7125d2638372ec85aa0fe6c807105cf10b0265ca6c"
+dependencies = [
+ "frunk_proc_macro_helpers",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "frunk_proc_macro_helpers"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1952b802269f2db12ab7c0bd328d0ae8feaabf19f352a7b0af7bb0c5693abfce"
+dependencies = [
+ "frunk_core",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "frunk_proc_macros"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3462f590fa236005bd7ca4847f81438bd6fe0febd4d04e11968d4c2e96437e78"
+dependencies = [
+ "frunk_core",
+ "frunk_proc_macro_helpers",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "funty"
+version = "2.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
+
+[[package]]
+name = "futures-channel"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d"
+dependencies = [
+ "futures-core",
+]
+
+[[package]]
+name = "futures-core"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d"
+
+[[package]]
+name = "futures-macro"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "futures-sink"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893"
+
+[[package]]
+name = "futures-task"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393"
+
+[[package]]
+name = "futures-util"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6"
+dependencies = [
+ "futures-core",
+ "futures-macro",
+ "futures-task",
+ "pin-project-lite",
+ "slab",
+]
+
+[[package]]
+name = "generic-array"
+version = "0.14.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
+dependencies = [
+ "typenum",
+ "version_check",
+]
+
+[[package]]
+name = "getrandom"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "wasi",
+]
+
+[[package]]
+name = "getrandom"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "r-efi 5.3.0",
+ "wasip2",
+]
+
+[[package]]
+name = "getrandom"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "r-efi 6.0.0",
+ "wasip2",
+ "wasip3",
+]
+
+[[package]]
+name = "glob"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
+
+[[package]]
+name = "h2"
+version = "0.4.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "171fefbc92fe4a4de27e0698d6a5b392d6a0e333506bc49133760b3bcf948733"
+dependencies = [
+ "atomic-waker",
+ "bytes",
+ "fnv",
+ "futures-core",
+ "futures-sink",
+ "http",
+ "indexmap",
+ "slab",
+ "tokio",
+ "tokio-util",
+ "tracing",
+]
+
+[[package]]
+name = "hashbrown"
+version = "0.12.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
+dependencies = [
+ "ahash",
+]
+
+[[package]]
+name = "hashbrown"
+version = "0.15.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
+dependencies = [
+ "allocator-api2",
+ "equivalent",
+ "foldhash",
+]
+
+[[package]]
+name = "hashbrown"
+version = "0.17.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
+
+[[package]]
+name = "heck"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
+
+[[package]]
+name = "hermit-abi"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c"
+
+[[package]]
+name = "http"
+version = "1.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8be7462df143984c4598a256ef469b251d7d7f9e271135073e78fc535414f3d0"
+dependencies = [
+ "bytes",
+ "itoa",
+]
+
+[[package]]
+name = "http-body"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184"
+dependencies = [
+ "bytes",
+ "http",
+]
+
+[[package]]
+name = "http-body-util"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a"
+dependencies = [
+ "bytes",
+ "futures-core",
+ "http",
+ "http-body",
+ "pin-project-lite",
+]
+
+[[package]]
+name = "httparse"
+version = "1.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
+
+[[package]]
+name = "httpdate"
+version = "1.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
+
+[[package]]
+name = "hyper"
+version = "1.10.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eb92f162bf56536459fc83c79b974bb12837acfed43d6bc370a7916d0ae15ecc"
+dependencies = [
+ "atomic-waker",
+ "bytes",
+ "futures-channel",
+ "futures-core",
+ "h2",
+ "http",
+ "http-body",
+ "httparse",
+ "itoa",
+ "pin-project-lite",
+ "smallvec",
+ "tokio",
+ "want",
+]
+
+[[package]]
+name = "hyper-rustls"
+version = "0.27.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f"
+dependencies = [
+ "http",
+ "hyper",
+ "hyper-util",
+ "rustls",
+ "tokio",
+ "tokio-rustls",
+ "tower-service",
+]
+
+[[package]]
+name = "hyper-tls"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
+dependencies = [
+ "bytes",
+ "http-body-util",
+ "hyper",
+ "hyper-util",
+ "native-tls",
+ "tokio",
+ "tokio-native-tls",
+ "tower-service",
+]
+
+[[package]]
+name = "hyper-util"
+version = "0.1.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0"
+dependencies = [
+ "base64 0.22.1",
+ "bytes",
+ "futures-channel",
+ "futures-util",
+ "http",
+ "http-body",
+ "hyper",
+ "ipnet",
+ "libc",
+ "percent-encoding",
+ "pin-project-lite",
+ "socket2 0.6.4",
+ "system-configuration",
+ "tokio",
+ "tower-service",
+ "tracing",
+ "windows-registry",
+]
+
+[[package]]
+name = "icu_collections"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c"
+dependencies = [
+ "displaydoc",
+ "potential_utf",
+ "utf8_iter",
+ "yoke",
+ "zerofrom",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_locale_core"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29"
+dependencies = [
+ "displaydoc",
+ "litemap",
+ "tinystr",
+ "writeable",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_normalizer"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4"
+dependencies = [
+ "icu_collections",
+ "icu_normalizer_data",
+ "icu_properties",
+ "icu_provider",
+ "smallvec",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_normalizer_data"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38"
+
+[[package]]
+name = "icu_properties"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de"
+dependencies = [
+ "icu_collections",
+ "icu_locale_core",
+ "icu_properties_data",
+ "icu_provider",
+ "zerotrie",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_properties_data"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14"
+
+[[package]]
+name = "icu_provider"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421"
+dependencies = [
+ "displaydoc",
+ "icu_locale_core",
+ "writeable",
+ "yoke",
+ "zerofrom",
+ "zerotrie",
+ "zerovec",
+]
+
+[[package]]
+name = "id-arena"
+version = "2.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"
+
+[[package]]
+name = "ident_case"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
+
+[[package]]
+name = "idna"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"
+dependencies = [
+ "idna_adapter",
+ "smallvec",
+ "utf8_iter",
+]
+
+[[package]]
+name = "idna_adapter"
+version = "1.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714"
+dependencies = [
+ "icu_normalizer",
+ "icu_properties",
+]
+
+[[package]]
+name = "indexmap"
+version = "2.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
+dependencies = [
+ "equivalent",
+ "hashbrown 0.17.1",
+ "serde",
+ "serde_core",
+]
+
+[[package]]
+name = "ipnet"
+version = "2.12.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2"
+
+[[package]]
+name = "is-terminal"
+version = "0.4.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46"
+dependencies = [
+ "hermit-abi",
+ "libc",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "is_terminal_polyfill"
+version = "1.70.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695"
+
+[[package]]
+name = "itertools"
+version = "0.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
+dependencies = [
+ "either",
+]
+
+[[package]]
+name = "itoa"
+version = "1.0.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
+
+[[package]]
+name = "jobserver"
+version = "0.1.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33"
+dependencies = [
+ "getrandom 0.3.4",
+ "libc",
+]
+
+[[package]]
+name = "js-sys"
+version = "0.3.99"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "142bc4740e452c1e57ade0cbc129f139c9093e354346f0872ef985f4f5cf5f11"
+dependencies = [
+ "cfg-if",
+ "futures-util",
+ "once_cell",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "keyed_priority_queue"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4ee7893dab2e44ae5f9d0173f26ff4aa327c10b01b06a72b52dd9405b628640d"
+dependencies = [
+ "indexmap",
+]
+
+[[package]]
+name = "lazy_static"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
+
+[[package]]
+name = "leb128fmt"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
+
+[[package]]
+name = "libc"
+version = "0.2.186"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
+
+[[package]]
+name = "libloading"
+version = "0.8.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
+dependencies = [
+ "cfg-if",
+ "windows-link",
+]
+
+[[package]]
+name = "libm"
+version = "0.2.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
+
+[[package]]
+name = "libredox"
+version = "0.1.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f02ab6bace2054fb888a3c16f990117b579d14a3088e472d63c6011fa185c9d3"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "libz-sys"
+version = "1.1.28"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fc3a226e576f50782b3305c5ccf458698f92798987f551c6a02efe8276721e22"
+dependencies = [
+ "cc",
+ "pkg-config",
+ "vcpkg",
+]
+
+[[package]]
+name = "linux-raw-sys"
+version = "0.4.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
+
+[[package]]
+name = "linux-raw-sys"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
+
+[[package]]
+name = "litemap"
+version = "0.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0"
+
+[[package]]
+name = "lock_api"
+version = "0.4.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
+dependencies = [
+ "scopeguard",
+]
+
+[[package]]
+name = "log"
+version = "0.4.30"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "616ec5685824bcc94416c6d4a7a446eea774a31efd7062c8480ba6fd06d7a6e5"
+
+[[package]]
+name = "lru"
+version = "0.12.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38"
+dependencies = [
+ "hashbrown 0.15.5",
+]
+
+[[package]]
+name = "matchers"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9"
+dependencies = [
+ "regex-automata",
+]
+
+[[package]]
+name = "memchr"
+version = "2.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6b947ae49db0d222b1dbc6b113ce7248a3fc3a6ca21b696717bfc000ba4484d8"
+
+[[package]]
+name = "mime"
+version = "0.3.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
+
+[[package]]
+name = "minimal-lexical"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
+
+[[package]]
+name = "miniz_oxide"
+version = "0.8.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
+dependencies = [
+ "adler2",
+ "simd-adler32",
+]
+
+[[package]]
+name = "mio"
+version = "1.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "02bd0af71c67b473010cbbc60715ee815645a4dc942899111f494b4b737d6fda"
+dependencies = [
+ "libc",
+ "wasi",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "mysql-common-derive"
+version = "0.31.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "63c3512cf11487168e0e9db7157801bf5273be13055a9cc95356dc9e0035e49c"
+dependencies = [
+ "darling",
+ "heck",
+ "num-bigint",
+ "proc-macro-crate",
+ "proc-macro-error2",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+ "termcolor",
+ "thiserror 1.0.69",
+]
+
+[[package]]
+name = "mysql_async"
+version = "0.34.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a0b66e411c31265e879d9814d03721f2daa7ad07337b6308cb4bb0cde7e6fd47"
+dependencies = [
+ "bytes",
+ "crossbeam",
+ "flate2",
+ "futures-core",
+ "futures-sink",
+ "futures-util",
+ "keyed_priority_queue",
+ "lru",
+ "mysql_common",
+ "native-tls",
+ "pem",
+ "percent-encoding",
+ "pin-project",
+ "rand",
+ "serde",
+ "serde_json",
+ "socket2 0.5.10",
+ "thiserror 1.0.69",
+ "tokio",
+ "tokio-native-tls",
+ "tokio-util",
+ "twox-hash",
+ "url",
+]
+
+[[package]]
+name = "mysql_common"
+version = "0.32.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "478b0ff3f7d67b79da2b96f56f334431aef65e15ba4b29dd74a4236e29582bdc"
+dependencies = [
+ "base64 0.21.7",
+ "bigdecimal",
+ "bindgen",
+ "bitflags",
+ "bitvec",
+ "btoi",
+ "byteorder",
+ "bytes",
+ "cc",
+ "cmake",
+ "crc32fast",
+ "flate2",
+ "frunk",
+ "lazy_static",
+ "mysql-common-derive",
+ "num-bigint",
+ "num-traits",
+ "rand",
+ "regex",
+ "rust_decimal",
+ "saturating",
+ "serde",
+ "serde_json",
+ "sha1",
+ "sha2",
+ "smallvec",
+ "subprocess",
+ "thiserror 1.0.69",
+ "time",
+ "uuid",
+ "zstd",
+]
+
+[[package]]
+name = "native-tls"
+version = "0.2.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2"
+dependencies = [
+ "libc",
+ "log",
+ "openssl",
+ "openssl-probe",
+ "openssl-sys",
+ "schannel",
+ "security-framework",
+ "security-framework-sys",
+ "tempfile",
+]
+
+[[package]]
+name = "nom"
+version = "7.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
+dependencies = [
+ "memchr",
+ "minimal-lexical",
+]
+
+[[package]]
+name = "normalize-line-endings"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be"
+
+[[package]]
+name = "nu-ansi-term"
+version = "0.50.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
+dependencies = [
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "num-bigint"
+version = "0.4.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9"
+dependencies = [
+ "num-integer",
+ "num-traits",
+]
+
+[[package]]
+name = "num-conv"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
+
+[[package]]
+name = "num-integer"
+version = "0.1.46"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
+dependencies = [
+ "num-traits",
+]
+
+[[package]]
+name = "num-traits"
+version = "0.2.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
+dependencies = [
+ "autocfg",
+]
+
+[[package]]
+name = "once_cell"
+version = "1.21.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
+
+[[package]]
+name = "once_cell_polyfill"
+version = "1.70.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
+
+[[package]]
+name = "openssl"
+version = "0.10.80"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a45fa2aa886c42762255da344f0a0d313e254066c46aad76f300c3d3da62d967"
+dependencies = [
+ "bitflags",
+ "cfg-if",
+ "foreign-types",
+ "libc",
+ "openssl-macros",
+ "openssl-sys",
+]
+
+[[package]]
+name = "openssl-macros"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "openssl-probe"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe"
+
+[[package]]
+name = "openssl-src"
+version = "300.6.0+3.6.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a8e8cbfd3a4a8c8f089147fd7aaa33cf8c7450c4d09f8f80698a0cf093abeff4"
+dependencies = [
+ "cc",
+]
+
+[[package]]
+name = "openssl-sys"
+version = "0.9.116"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f28a22dc7140cda5f096e5e7724a6962ca81a7f8bfd2979f9b18c11af56318c4"
+dependencies = [
+ "cc",
+ "libc",
+ "openssl-src",
+ "pkg-config",
+ "vcpkg",
+]
+
+[[package]]
+name = "option-ext"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
+
+[[package]]
+name = "parking_lot"
+version = "0.12.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
+dependencies = [
+ "lock_api",
+ "parking_lot_core",
+]
+
+[[package]]
+name = "parking_lot_core"
+version = "0.9.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "redox_syscall",
+ "smallvec",
+ "windows-link",
+]
+
+[[package]]
+name = "pem"
+version = "3.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1d30c53c26bc5b31a98cd02d20f25a7c8567146caf63ed593a9d87b2775291be"
+dependencies = [
+ "base64 0.22.1",
+ "serde_core",
+]
+
+[[package]]
+name = "percent-encoding"
+version = "2.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
+
+[[package]]
+name = "pin-project"
+version = "1.1.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924"
+dependencies = [
+ "pin-project-internal",
+]
+
+[[package]]
+name = "pin-project-internal"
+version = "1.1.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "pin-project-lite"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
+
+[[package]]
+name = "pkg-config"
+version = "0.3.33"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e"
+
+[[package]]
+name = "potential_utf"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564"
+dependencies = [
+ "zerovec",
+]
+
+[[package]]
+name = "powerfmt"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
+
+[[package]]
+name = "ppv-lite86"
+version = "0.2.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
+dependencies = [
+ "zerocopy",
+]
+
+[[package]]
+name = "predicates"
+version = "3.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ada8f2932f28a27ee7b70dd6c1c39ea0675c55a36879ab92f3a715eaa1e63cfe"
+dependencies = [
+ "anstyle",
+ "difflib",
+ "float-cmp",
+ "normalize-line-endings",
+ "predicates-core",
+ "regex",
+]
+
+[[package]]
+name = "predicates-core"
+version = "1.0.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cad38746f3166b4031b1a0d39ad9f954dd291e7854fcc0eed52ee41a0b50d144"
+
+[[package]]
+name = "predicates-tree"
+version = "1.0.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d0de1b847b39c8131db0467e9df1ff60e6d0562ab8e9a16e568ad0fdb372e2f2"
+dependencies = [
+ "predicates-core",
+ "termtree",
+]
+
+[[package]]
+name = "prettyplease"
+version = "0.2.37"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
+dependencies = [
+ "proc-macro2",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "proc-macro-crate"
+version = "3.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f"
+dependencies = [
+ "toml_edit 0.25.12+spec-1.1.0",
+]
+
+[[package]]
+name = "proc-macro-error-attr2"
+version = "2.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5"
+dependencies = [
+ "proc-macro2",
+ "quote",
+]
+
+[[package]]
+name = "proc-macro-error2"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802"
+dependencies = [
+ "proc-macro-error-attr2",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.106"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "ptr_meta"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1"
+dependencies = [
+ "ptr_meta_derive",
+]
+
+[[package]]
+name = "ptr_meta_derive"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.45"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "r-efi"
+version = "5.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
+
+[[package]]
+name = "r-efi"
+version = "6.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
+
+[[package]]
+name = "radium"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
+
+[[package]]
+name = "rand"
+version = "0.8.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a"
+dependencies = [
+ "libc",
+ "rand_chacha",
+ "rand_core",
+]
+
+[[package]]
+name = "rand_chacha"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
+dependencies = [
+ "ppv-lite86",
+ "rand_core",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
+dependencies = [
+ "getrandom 0.2.17",
+]
+
+[[package]]
+name = "redox_syscall"
+version = "0.5.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
+dependencies = [
+ "bitflags",
+]
+
+[[package]]
+name = "redox_users"
+version = "0.4.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"
+dependencies = [
+ "getrandom 0.2.17",
+ "libredox",
+ "thiserror 1.0.69",
+]
+
+[[package]]
+name = "regex"
+version = "1.12.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-automata",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-automata"
+version = "0.4.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-syntax"
+version = "0.8.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a"
+
+[[package]]
+name = "rend"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "71fe3824f5629716b1589be05dacd749f6aa084c87e00e016714a8cdfccc997c"
+dependencies = [
+ "bytecheck",
+]
+
+[[package]]
+name = "reqwest"
+version = "0.12.28"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147"
+dependencies = [
+ "base64 0.22.1",
+ "bytes",
+ "encoding_rs",
+ "futures-core",
+ "h2",
+ "http",
+ "http-body",
+ "http-body-util",
+ "hyper",
+ "hyper-rustls",
+ "hyper-tls",
+ "hyper-util",
+ "js-sys",
+ "log",
+ "mime",
+ "native-tls",
+ "percent-encoding",
+ "pin-project-lite",
+ "rustls-pki-types",
+ "serde",
+ "serde_json",
+ "serde_urlencoded",
+ "sync_wrapper",
+ "tokio",
+ "tokio-native-tls",
+ "tower",
+ "tower-http",
+ "tower-service",
+ "url",
+ "wasm-bindgen",
+ "wasm-bindgen-futures",
+ "web-sys",
+]
+
+[[package]]
+name = "ring"
+version = "0.17.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
+dependencies = [
+ "cc",
+ "cfg-if",
+ "getrandom 0.2.17",
+ "libc",
+ "untrusted",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "rkyv"
+version = "0.7.46"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2297bf9c81a3f0dc96bc9521370b88f054168c29826a75e89c55ff196e7ed6a1"
+dependencies = [
+ "bitvec",
+ "bytecheck",
+ "bytes",
+ "hashbrown 0.12.3",
+ "ptr_meta",
+ "rend",
+ "rkyv_derive",
+ "seahash",
+ "tinyvec",
+ "uuid",
+]
+
+[[package]]
+name = "rkyv_derive"
+version = "0.7.46"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "84d7b42d4b8d06048d3ac8db0eb31bcb942cbeb709f0b5f2b2ebde398d3038f5"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "rust_decimal"
+version = "1.42.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c5108e3d4d903e21aac27f12ba5377b6b34f9f44b325e4894c7924169d06995"
+dependencies = [
+ "arrayvec",
+ "borsh",
+ "bytes",
+ "num-traits",
+ "rand",
+ "rkyv",
+ "serde",
+ "serde_json",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "rustc-hash"
+version = "2.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe"
+
+[[package]]
+name = "rustix"
+version = "0.38.44"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
+dependencies = [
+ "bitflags",
+ "errno",
+ "libc",
+ "linux-raw-sys 0.4.15",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "rustix"
+version = "1.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190"
+dependencies = [
+ "bitflags",
+ "errno",
+ "libc",
+ "linux-raw-sys 0.12.1",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "rustls"
+version = "0.23.40"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ef86cd5876211988985292b91c96a8f2d298df24e75989a43a3c73f2d4d8168b"
+dependencies = [
+ "once_cell",
+ "rustls-pki-types",
+ "rustls-webpki",
+ "subtle",
+ "zeroize",
+]
+
+[[package]]
+name = "rustls-pki-types"
+version = "1.14.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "30a7197ae7eb376e574fe940d068c30fe0462554a3ddbe4eca7838e049c937a9"
+dependencies = [
+ "zeroize",
+]
+
+[[package]]
+name = "rustls-webpki"
+version = "0.103.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e"
+dependencies = [
+ "ring",
+ "rustls-pki-types",
+ "untrusted",
+]
+
+[[package]]
+name = "rustversion"
+version = "1.0.22"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
+
+[[package]]
+name = "ryu"
+version = "1.0.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f"
+
+[[package]]
+name = "saturating"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ece8e78b2f38ec51c51f5d475df0a7187ba5111b2a28bdc761ee05b075d40a71"
+
+[[package]]
+name = "schannel"
+version = "0.1.29"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939"
+dependencies = [
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "scopeguard"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
+
+[[package]]
+name = "seahash"
+version = "4.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
+
+[[package]]
+name = "security-framework"
+version = "3.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d"
+dependencies = [
+ "bitflags",
+ "core-foundation 0.10.1",
+ "core-foundation-sys",
+ "libc",
+ "security-framework-sys",
+]
+
+[[package]]
+name = "security-framework-sys"
+version = "2.17.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
+[[package]]
+name = "semver"
+version = "1.0.28"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
+
+[[package]]
+name = "serde"
+version = "1.0.228"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
+dependencies = [
+ "serde_core",
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_core"
+version = "1.0.228"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.228"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "serde_json"
+version = "1.0.150"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9"
+dependencies = [
+ "itoa",
+ "memchr",
+ "serde",
+ "serde_core",
+ "zmij",
+]
+
+[[package]]
+name = "serde_spanned"
+version = "0.6.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "serde_urlencoded"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
+dependencies = [
+ "form_urlencoded",
+ "itoa",
+ "ryu",
+ "serde",
+]
+
+[[package]]
+name = "sha1"
+version = "0.10.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba"
+dependencies = [
+ "cfg-if",
+ "cpufeatures",
+ "digest",
+]
+
+[[package]]
+name = "sha2"
+version = "0.10.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
+dependencies = [
+ "cfg-if",
+ "cpufeatures",
+ "digest",
+]
+
+[[package]]
+name = "sharded-slab"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"
+dependencies = [
+ "lazy_static",
+]
+
+[[package]]
+name = "shlex"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
+
+[[package]]
+name = "simd-adler32"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214"
+
+[[package]]
+name = "simdutf8"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
+
+[[package]]
+name = "slab"
+version = "0.4.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
+
+[[package]]
+name = "smallvec"
+version = "1.15.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
+
+[[package]]
+name = "socket2"
+version = "0.5.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678"
+dependencies = [
+ "libc",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "socket2"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "52d1cfed4120b4d927bf7c0f86d2087a4a7d6027c906d9f9d525a80573b9be51"
+dependencies = [
+ "libc",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "stable_deref_trait"
+version = "1.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
+
+[[package]]
+name = "static_assertions"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
+
+[[package]]
+name = "strsim"
+version = "0.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
+
+[[package]]
+name = "subprocess"
+version = "0.2.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c2e86926081dda636c546d8c5e641661049d7562a68f5488be4a1f7f66f6086"
+dependencies = [
+ "libc",
+ "winapi",
+]
+
+[[package]]
+name = "subtle"
+version = "2.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
+
+[[package]]
+name = "syn"
+version = "1.0.109"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "syn"
+version = "2.0.117"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "sync_wrapper"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"
+dependencies = [
+ "futures-core",
+]
+
+[[package]]
+name = "synstructure"
+version = "0.13.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "system-configuration"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b"
+dependencies = [
+ "bitflags",
+ "core-foundation 0.9.4",
+ "system-configuration-sys",
+]
+
+[[package]]
+name = "system-configuration-sys"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
+[[package]]
+name = "tap"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
+
+[[package]]
+name = "tempfile"
+version = "3.27.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
+dependencies = [
+ "fastrand",
+ "getrandom 0.4.2",
+ "once_cell",
+ "rustix 1.1.4",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "termcolor"
+version = "1.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
+dependencies = [
+ "winapi-util",
+]
+
+[[package]]
+name = "termtree"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683"
+
+[[package]]
+name = "thiserror"
+version = "1.0.69"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
+dependencies = [
+ "thiserror-impl 1.0.69",
+]
+
+[[package]]
+name = "thiserror"
+version = "2.0.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"
+dependencies = [
+ "thiserror-impl 2.0.18",
+]
+
+[[package]]
+name = "thiserror-impl"
+version = "1.0.69"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "thiserror-impl"
+version = "2.0.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "thread_local"
+version = "1.1.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "time"
+version = "0.3.45"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f9e442fc33d7fdb45aa9bfeb312c095964abdf596f7567261062b2a7107aaabd"
+dependencies = [
+ "deranged",
+ "num-conv",
+ "powerfmt",
+ "serde_core",
+ "time-core",
+ "time-macros",
+]
+
+[[package]]
+name = "time-core"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b36ee98fd31ec7426d599183e8fe26932a8dc1fb76ddb6214d05493377d34ca"
+
+[[package]]
+name = "time-macros"
+version = "0.2.25"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "71e552d1249bf61ac2a52db88179fd0673def1e1ad8243a00d9ec9ed71fee3dd"
+dependencies = [
+ "num-conv",
+ "time-core",
+]
+
+[[package]]
+name = "tiny_http"
+version = "0.12.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "389915df6413a2e74fb181895f933386023c71110878cd0825588928e64cdc82"
+dependencies = [
+ "ascii",
+ "chunked_transfer",
+ "httpdate",
+ "log",
+]
+
+[[package]]
+name = "tinystr"
+version = "0.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d"
+dependencies = [
+ "displaydoc",
+ "zerovec",
+]
+
+[[package]]
+name = "tinyvec"
+version = "1.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3"
+dependencies = [
+ "tinyvec_macros",
+]
+
+[[package]]
+name = "tinyvec_macros"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
+
+[[package]]
+name = "tokio"
+version = "1.52.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe"
+dependencies = [
+ "bytes",
+ "libc",
+ "mio",
+ "pin-project-lite",
+ "socket2 0.6.4",
+ "tokio-macros",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "tokio-macros"
+version = "2.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "tokio-native-tls"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
+dependencies = [
+ "native-tls",
+ "tokio",
+]
+
+[[package]]
+name = "tokio-rustls"
+version = "0.26.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61"
+dependencies = [
+ "rustls",
+ "tokio",
+]
+
+[[package]]
+name = "tokio-socks"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0d4770b8024672c1101b3f6733eab95b18007dbe0847a8afe341fcf79e06043f"
+dependencies = [
+ "either",
+ "futures-util",
+ "thiserror 1.0.69",
+ "tokio",
+]
+
+[[package]]
+name = "tokio-util"
+version = "0.7.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098"
+dependencies = [
+ "bytes",
+ "futures-core",
+ "futures-sink",
+ "pin-project-lite",
+ "tokio",
+]
+
+[[package]]
+name = "toml"
+version = "0.8.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
+dependencies = [
+ "serde",
+ "serde_spanned",
+ "toml_datetime 0.6.11",
+ "toml_edit 0.22.27",
+]
+
+[[package]]
+name = "toml_datetime"
+version = "0.6.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "toml_datetime"
+version = "1.1.1+spec-1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7"
+dependencies = [
+ "serde_core",
+]
+
+[[package]]
+name = "toml_edit"
+version = "0.22.27"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
+dependencies = [
+ "indexmap",
+ "serde",
+ "serde_spanned",
+ "toml_datetime 0.6.11",
+ "toml_write",
+ "winnow 0.7.15",
+]
+
+[[package]]
+name = "toml_edit"
+version = "0.25.12+spec-1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d2153edc6955a6c354fad8f5efd38b6a8769bdccf9fe50f8e1329f81b0baa5d7"
+dependencies = [
+ "indexmap",
+ "toml_datetime 1.1.1+spec-1.1.0",
+ "toml_parser",
+ "winnow 1.0.3",
+]
+
+[[package]]
+name = "toml_parser"
+version = "1.1.2+spec-1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526"
+dependencies = [
+ "winnow 1.0.3",
+]
+
+[[package]]
+name = "toml_write"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
+
+[[package]]
+name = "tower"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4"
+dependencies = [
+ "futures-core",
+ "futures-util",
+ "pin-project-lite",
+ "sync_wrapper",
+ "tokio",
+ "tower-layer",
+ "tower-service",
+]
+
+[[package]]
+name = "tower-http"
+version = "0.6.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840"
+dependencies = [
+ "bitflags",
+ "bytes",
+ "futures-util",
+ "http",
+ "http-body",
+ "pin-project-lite",
+ "tower",
+ "tower-layer",
+ "tower-service",
+ "url",
+]
+
+[[package]]
+name = "tower-layer"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e"
+
+[[package]]
+name = "tower-service"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
+
+[[package]]
+name = "tracing"
+version = "0.1.44"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
+dependencies = [
+ "pin-project-lite",
+ "tracing-attributes",
+ "tracing-core",
+]
+
+[[package]]
+name = "tracing-attributes"
+version = "0.1.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "tracing-core"
+version = "0.1.36"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"
+dependencies = [
+ "once_cell",
+ "valuable",
+]
+
+[[package]]
+name = "tracing-log"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
+dependencies = [
+ "log",
+ "once_cell",
+ "tracing-core",
+]
+
+[[package]]
+name = "tracing-subscriber"
+version = "0.3.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319"
+dependencies = [
+ "matchers",
+ "nu-ansi-term",
+ "once_cell",
+ "regex-automata",
+ "sharded-slab",
+ "smallvec",
+ "thread_local",
+ "tracing",
+ "tracing-core",
+ "tracing-log",
+]
+
+[[package]]
+name = "try-lock"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
+
+[[package]]
+name = "twox-hash"
+version = "1.6.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675"
+dependencies = [
+ "cfg-if",
+ "rand",
+ "static_assertions",
+]
+
+[[package]]
+name = "typenum"
+version = "1.20.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "40ce102ab67701b8526c123c1bab5cbe42d7040ccfd0f64af1a385808d2f43de"
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
+
+[[package]]
+name = "unicode-segmentation"
+version = "1.13.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9629274872b2bfaf8d66f5f15725007f635594914870f65218920345aa11aa8c"
+
+[[package]]
+name = "unicode-width"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
+
+[[package]]
+name = "unicode-xid"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
+
+[[package]]
+name = "untrusted"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
+
+[[package]]
+name = "url"
+version = "2.5.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"
+dependencies = [
+ "form_urlencoded",
+ "idna",
+ "percent-encoding",
+ "serde",
+]
+
+[[package]]
+name = "utf8_iter"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
+
+[[package]]
+name = "utf8parse"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
+
+[[package]]
+name = "uuid"
+version = "1.23.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ddd74a9687298c6858e9b88ec8935ec45d22e8fd5e6394fa1bd4e99a87789c76"
+dependencies = [
+ "js-sys",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "valuable"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"
+
+[[package]]
+name = "vcpkg"
+version = "0.2.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
+
+[[package]]
+name = "version_check"
+version = "0.9.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
+
+[[package]]
+name = "wait-timeout"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "want"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
+dependencies = [
+ "try-lock",
+]
+
+[[package]]
+name = "wasi"
+version = "0.11.1+wasi-snapshot-preview1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
+
+[[package]]
+name = "wasip2"
+version = "1.0.3+wasi-0.2.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6"
+dependencies = [
+ "wit-bindgen 0.57.1",
+]
+
+[[package]]
+name = "wasip3"
+version = "0.4.0+wasi-0.3.0-rc-2026-01-06"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5"
+dependencies = [
+ "wit-bindgen 0.51.0",
+]
+
+[[package]]
+name = "wasm-bindgen"
+version = "0.2.122"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3ed04576f974d2b2fba0f38c51dbc5518011e38c36bf1143164be765528fd409"
+dependencies = [
+ "cfg-if",
+ "once_cell",
+ "rustversion",
+ "serde",
+ "wasm-bindgen-macro",
+ "wasm-bindgen-shared",
+]
+
+[[package]]
+name = "wasm-bindgen-futures"
+version = "0.4.72"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9473dbd2991ae90b6291c3c32c30c6187ac49aa32f9905d1cce280ec1e110b0f"
+dependencies = [
+ "js-sys",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "wasm-bindgen-macro"
+version = "0.2.122"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "916151b09da36bd82f6615cbf3a419e2f0ba23a03c6160e8e92eb6bd4aa1dec6"
+dependencies = [
+ "quote",
+ "wasm-bindgen-macro-support",
+]
+
+[[package]]
+name = "wasm-bindgen-macro-support"
+version = "0.2.122"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "299047362ccbfce148b67ab7e73349f77748e00c8296f9542adfad2ad82c5c5e"
+dependencies = [
+ "bumpalo",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+ "wasm-bindgen-shared",
+]
+
+[[package]]
+name = "wasm-bindgen-shared"
+version = "0.2.122"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a929b2c61f11ba3e9bc35b50c1f25cb38e0e892c0c231ae2b8cf78d5dad4437"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "wasm-encoder"
+version = "0.244.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319"
+dependencies = [
+ "leb128fmt",
+ "wasmparser",
+]
+
+[[package]]
+name = "wasm-metadata"
+version = "0.244.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909"
+dependencies = [
+ "anyhow",
+ "indexmap",
+ "wasm-encoder",
+ "wasmparser",
+]
+
+[[package]]
+name = "wasmparser"
+version = "0.244.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe"
+dependencies = [
+ "bitflags",
+ "hashbrown 0.15.5",
+ "indexmap",
+ "semver",
+]
+
+[[package]]
+name = "web-sys"
+version = "0.3.99"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6d621441cfc37b84979402712047321980c178f299193a3589d05b99e8763436"
+dependencies = [
+ "js-sys",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "winapi"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
+dependencies = [
+ "winapi-i686-pc-windows-gnu",
+ "winapi-x86_64-pc-windows-gnu",
+]
+
+[[package]]
+name = "winapi-i686-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
+
+[[package]]
+name = "winapi-util"
+version = "0.1.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
+dependencies = [
+ "windows-sys 0.48.0",
+]
+
+[[package]]
+name = "winapi-x86_64-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
+
+[[package]]
+name = "windows-link"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
+
+[[package]]
+name = "windows-registry"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720"
+dependencies = [
+ "windows-link",
+ "windows-result",
+ "windows-strings",
+]
+
+[[package]]
+name = "windows-result"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
+dependencies = [
+ "windows-link",
+]
+
+[[package]]
+name = "windows-strings"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
+dependencies = [
+ "windows-link",
+]
+
+[[package]]
+name = "windows-sys"
+version = "0.48.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
+dependencies = [
+ "windows-targets 0.48.5",
+]
+
+[[package]]
+name = "windows-sys"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
+dependencies = [
+ "windows-targets 0.52.6",
+]
+
+[[package]]
+name = "windows-sys"
+version = "0.61.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
+dependencies = [
+ "windows-link",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
+dependencies = [
+ "windows_aarch64_gnullvm 0.48.5",
+ "windows_aarch64_msvc 0.48.5",
+ "windows_i686_gnu 0.48.5",
+ "windows_i686_msvc 0.48.5",
+ "windows_x86_64_gnu 0.48.5",
+ "windows_x86_64_gnullvm 0.48.5",
+ "windows_x86_64_msvc 0.48.5",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
+dependencies = [
+ "windows_aarch64_gnullvm 0.52.6",
+ "windows_aarch64_msvc 0.52.6",
+ "windows_i686_gnu 0.52.6",
+ "windows_i686_gnullvm",
+ "windows_i686_msvc 0.52.6",
+ "windows_x86_64_gnu 0.52.6",
+ "windows_x86_64_gnullvm 0.52.6",
+ "windows_x86_64_msvc 0.52.6",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
+
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
+
+[[package]]
+name = "winnow"
+version = "0.7.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "winnow"
+version = "1.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0592e1c9d151f854e6fd382574c3a0855250e1d9b2f99d9281c6e6391af352f1"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "wit-bindgen"
+version = "0.51.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5"
+dependencies = [
+ "wit-bindgen-rust-macro",
+]
+
+[[package]]
+name = "wit-bindgen"
+version = "0.57.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e"
+
+[[package]]
+name = "wit-bindgen-core"
+version = "0.51.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc"
+dependencies = [
+ "anyhow",
+ "heck",
+ "wit-parser",
+]
+
+[[package]]
+name = "wit-bindgen-rust"
+version = "0.51.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21"
+dependencies = [
+ "anyhow",
+ "heck",
+ "indexmap",
+ "prettyplease",
+ "syn 2.0.117",
+ "wasm-metadata",
+ "wit-bindgen-core",
+ "wit-component",
+]
+
+[[package]]
+name = "wit-bindgen-rust-macro"
+version = "0.51.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a"
+dependencies = [
+ "anyhow",
+ "prettyplease",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+ "wit-bindgen-core",
+ "wit-bindgen-rust",
+]
+
+[[package]]
+name = "wit-component"
+version = "0.244.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2"
+dependencies = [
+ "anyhow",
+ "bitflags",
+ "indexmap",
+ "log",
+ "serde",
+ "serde_derive",
+ "serde_json",
+ "wasm-encoder",
+ "wasm-metadata",
+ "wasmparser",
+ "wit-parser",
+]
+
+[[package]]
+name = "wit-parser"
+version = "0.244.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736"
+dependencies = [
+ "anyhow",
+ "id-arena",
+ "indexmap",
+ "log",
+ "semver",
+ "serde",
+ "serde_derive",
+ "serde_json",
+ "unicode-xid",
+ "wasmparser",
+]
+
+[[package]]
+name = "writeable"
+version = "0.6.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4"
+
+[[package]]
+name = "wyz"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed"
+dependencies = [
+ "tap",
+]
+
+[[package]]
+name = "yoke"
+version = "0.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca"
+dependencies = [
+ "stable_deref_trait",
+ "yoke-derive",
+ "zerofrom",
+]
+
+[[package]]
+name = "yoke-derive"
+version = "0.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+ "synstructure",
+]
+
+[[package]]
+name = "zerocopy"
+version = "0.8.49"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bce33a6288fa3f072a8c2c7d0f2fdbb90e28298f0135c1f99b96c3db2efcc60b"
+dependencies = [
+ "zerocopy-derive",
+]
+
+[[package]]
+name = "zerocopy-derive"
+version = "0.8.49"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8fd425244944f4ab65ccff928e7323354c5a018c75838362fdce749dfad2ee1e"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "zerofrom"
+version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272"
+dependencies = [
+ "zerofrom-derive",
+]
+
+[[package]]
+name = "zerofrom-derive"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+ "synstructure",
+]
+
+[[package]]
+name = "zeroize"
+version = "1.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0"
+
+[[package]]
+name = "zerotrie"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf"
+dependencies = [
+ "displaydoc",
+ "yoke",
+ "zerofrom",
+]
+
+[[package]]
+name = "zerovec"
+version = "0.11.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239"
+dependencies = [
+ "yoke",
+ "zerofrom",
+ "zerovec-derive",
+]
+
+[[package]]
+name = "zerovec-derive"
+version = "0.11.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "zmij"
+version = "1.0.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"
+
+[[package]]
+name = "zstd"
+version = "0.13.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a"
+dependencies = [
+ "zstd-safe",
+]
+
+[[package]]
+name = "zstd-safe"
+version = "7.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d"
+dependencies = [
+ "zstd-sys",
+]
+
+[[package]]
+name = "zstd-sys"
+version = "2.0.16+zstd.1.5.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "91e19ebc2adc8f83e43039e79776e3fda8ca919132d68a1fed6a5faca2683748"
+dependencies = [
+ "cc",
+ "pkg-config",
+]
diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644
index 0000000..25f9563
--- /dev/null
+++ b/Cargo.toml
@@ -0,0 +1,49 @@
+# Standalone crate (no shared workspace) — will move to its own repo.
+# The single-package [workspace] table only opts into the MSRV-aware resolver
+# so deps resolve to versions compatible with the installed rustc.
+[workspace]
+resolver = "3"
+
+[package]
+name = "doriscli"
+version = "0.3.8"
+edition = "2021"
+description = "Doris CLI — SQL, profiles, and tablet analysis against a Doris/VeloDB kernel"
+
+[[bin]]
+name = "doriscli"
+path = "src/main.rs"
+
+[dependencies]
+clap = { version = "4", features = ["derive"] }
+tokio = { version = "1", features = ["rt-multi-thread", "macros", "time"] }
+time = { version = "0.3", features = ["parsing"] }
+mysql_async = "0.34"
+reqwest = { version = "0.12", features = ["json", "socks"] }
+serde = { version = "1", features = ["derive"] }
+serde_json = "1"
+toml = "0.8"
+regex = "1.10"
+once_cell = "1.19"
+comfy-table = "7"
+dirs = "5"
+thiserror = "2"
+anyhow = "1"
+is-terminal = "0.4"
+tracing = "0.1"
+tracing-subscriber = { version = "0.3", features = ["env-filter"] }
+openssl = { version = "0.10", features = ["vendored"] }
+tokio-socks = "0.5"
+
+[dev-dependencies]
+assert_cmd = "2"
+predicates = "3"
+tiny_http = "0.12"
+tempfile = "3"
+
+[profile.release]
+opt-level = "z"
+lto = "fat"
+codegen-units = 1
+panic = "abort"
+strip = "symbols"
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..57bc88a
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,202 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..83c80f5
--- /dev/null
+++ b/README.md
@@ -0,0 +1,217 @@
+# doris-cli
+
+A fast, scriptable CLI for the **Apache Doris / VeloDB kernel**. It connects over the
+MySQL protocol (+ the FE HTTP API), executes, and returns **structured JSON** — a
+"tool, not a brain": all the intelligence lives in the layer above (an agent, a
+script, your shell). Every command prints machine-readable output and exits; there
+are no interactive prompts.
+
+The binary is `doriscli`.
+
+```bash
+doriscli sql "SELECT VERSION()"
+doriscli profile get <query_id>
+doriscli tablet db.orders --detail
+```
+
+---
+
+## Features
+
+- **SQL execution** — run a query (or a `.sql` file) and get back `query_id`,
+  `exec_time_ms`, `columns`, and `rows` as JSON. Set session variables, toggle the
+  query cache, or enable profiling inline.
+- **Query profile analysis** — fetch and parse Doris query profiles:
+  - a digest by default (summary + plan + operators + table context),
+  - the full parsed tree (`Fragment → Pipeline → Operator` with all counters) with `--full`,
+  - the raw profile text with `--raw`,
+  - **diff** two runs (slow vs. fast) to find the regression,
+  - **history** for a SQL pattern from `audit_log`,
+  - **list** recent or currently-running queries.
+- **Tablet & bucket analysis** — bucket/tablet distribution for a table, with a
+  `--detail` mode that breaks down per-partition stats, per-tablet rows/size, and the
+  backend mapping (find skew fast).
+- **Multi-environment auth** — save several connections; `auth status` probes the
+  connection and reports the Doris version, backends, and workload groups.
+- **SOCKS5 tunneling** — reach a BYOC / bastioned cluster through a SOCKS5 proxy.
+  Proxy credentials are never written to disk.
+- **Flexible output** — JSON when piped, a pretty table on a TTY, or CSV. Override
+  with `--format`.
+- **Stateless mode** — drive it entirely from environment variables (no files
+  touched), which is ideal for bastions, CI, and multi-tenant hosts.
+
+---
+
+## Build
+
+Requires a recent stable Rust toolchain (verified on rustc 1.87; the crate uses the
+MSRV-aware resolver and pins a few dependencies for older toolchains).
+
+```bash
+cargo build --release          # produces target/release/doriscli
+cargo run --release -- --version
+cargo test                     # unit tests
+```
+
+Put the binary on your `PATH`:
+
+```bash
+cp target/release/doriscli /usr/local/bin/
+```
+
+---
+
+## Quick start
+
+```bash
+# 1. Save a connection ("prod" is just a name you choose)
+doriscli auth add prod --host 127.0.0.1 --port 9030 --http-port 8030 \
+  --user root --password 'secret'
+
+# 2. Verify it (version, backends, workload groups, HTTP health)
+doriscli --env prod auth status
+
+# 3. Query
+doriscli --env prod sql "SELECT COUNT(*) FROM db.orders"
+```
+
+The first environment you add becomes the default, so `--env` is optional until you
+have more than one. Switch the default any time with `doriscli use <name>`.
+
+---
+
+## Commands
+
+### `auth` — manage connections
+
+```bash
+doriscli auth add <name> --host <h> --user <u> --password <p> [--port 9030] [--http-port 8030]
+doriscli auth add <name> --mysql "mysql://user:pass@host:9030"   # URI form
+doriscli auth list
+doriscli auth status            # test connection + cluster info
+doriscli auth remove <name>
+```
+
+`auth add` probes the FE HTTP port and, if it doesn't answer, suggests common
+alternatives (8080 for VeloDB Cloud FEs, 8030/8040 for Apache Doris) so `profile`
+commands work later.
+
+### `sql` — execute queries
+
+```bash
+doriscli sql "SELECT * FROM db.t LIMIT 10"
+doriscli sql -f migration.sql
+doriscli sql "SELECT ..." --profile            # SET enable_profile=true first
+doriscli sql "SELECT ..." --no-cache           # bypass the SQL cache (benchmarking)
+doriscli sql "SELECT ..." --set "exec_mem_limit=8g" --set "parallel_pipeline_task_num=8"
+```
+
+Output:
+
+```json
+{
+  "query_id": "f1e2...",
+  "exec_time_ms": 42,
+  "rows_returned": 10,
+  "columns": ["id", "name"],
+  "rows": [{ "id": 1, "name": "a" }]
+}
+```
+
+### `profile` — analyze query profiles
+
+```bash
+doriscli profile list [--limit 20] [--active]      # recent, or running queries
+doriscli profile get <query_id>                    # summary + plan + operators
+doriscli profile get <query_id> --full             # full Fragment→Pipeline→Operator tree
+doriscli profile get <query_id> --raw              # raw profile text
+doriscli profile get <query_id> -f exported.txt    # parse a profile saved from the web UI
+doriscli profile diff <slow_qid> <fast_qid>        # compare two runs
+doriscli profile history "<sql substring>" [--days 7] [--limit 50]
+```
+
+### `tablet` — bucket / tablet distribution
+
+```bash
+doriscli tablet db.orders                          # overview
+doriscli tablet db.orders --detail                 # per-partition + per-tablet + backends
+doriscli tablet db.orders --detail --partition p20240101
+```
+
+### `use` — switch the default environment
+
+```bash
+doriscli use            # show current + list environments
+doriscli use staging    # make "staging" the default
+```
+
+---
+
+## Global options
+
+| Option | Description |
+|---|---|
+| `--env <name>` | Which saved environment to use (default: `default`, or `$DORIS_ENV`). |
+| `--format <json\|table\|csv>` | Force the output format. Default: table on a TTY, JSON when piped. |
+| `--socks5 <user:pass@host:port>` | Route the connection through a SOCKS5 proxy (BYOC). |
+| `--init-sql <sql>` | Run a statement right after connecting (e.g. `USE @<compute-group>`). Overrides `$DORIS_INIT_SQL`. |
+
+---
+
+## Configuration & environment variables
+
+Saved environments live in `~/.doris/`:
+
+- `~/.doris/config.toml` — host, ports, user, per-environment.
+- `~/.doris/credentials.toml` — passwords (written `0600`).
+
+Every setting can also come from the environment (prefix `DORIS_`), which takes
+precedence over the config files:
+
+| Variable | Meaning | Default |
+|---|---|---|
+| `DORIS_HOST` | FE host | — |
+| `DORIS_USER` | MySQL user | — |
+| `DORIS_PASSWORD` | MySQL password | empty |
+| `DORIS_PORT` | MySQL/query port | `9030` |
+| `DORIS_HTTP_PORT` | FE HTTP port | `8030` |
+| `DORIS_ENV` | Which environment to use | `default` |
+| `DORIS_INIT_SQL` | Statement run after connect | — |
+| `DORIS_SOCKS5_HOST` / `_PORT` / `_USER` / `_PASS` | SOCKS5 proxy (BYOC) | user/pass default to `admin` |
+
+**Stateless mode:** when both `DORIS_HOST` and `DORIS_USER` are set, doris-cli
+connects purely from environment variables and never reads or writes any file —
+designed for bastions, CI, and multi-tenant hosts where `$HOME` may not be writable.
+
+```bash
+DORIS_HOST=fe.internal DORIS_USER=admin DORIS_PASSWORD=*** \
+  doriscli sql "SELECT 1"
+```
+
+---
+
+## Connecting to a cloud-hosted kernel
+
+doris-cli talks to any reachable Doris FE — including a cloud cluster — as long as
+you give it the resolved host/port. Compute-group routing (VeloDB Cloud) is handled
+by `--init-sql` (or `DORIS_INIT_SQL`), which runs `USE @<compute-group>` right after
+connecting:
+
+```bash
+DORIS_HOST=<resolved-host> DORIS_PORT=<port> DORIS_USER=admin DORIS_PASSWORD=*** \
+DORIS_INIT_SQL='USE @my_compute_group' \
+  doriscli sql "SELECT 1"
+```
+
+---
+
+## Output formats
+
+- **TTY** → a pretty table.
+- **Piped / redirected** → JSON (so `| jq` and scripts just work).
+- Force either, or CSV, with `--format json|table|csv`.
+
+```bash
+doriscli --env prod sql "SHOW BACKENDS" --format table
+doriscli --env prod sql "SELECT * FROM db.t" | jq '.rows[] | .id'
+```
diff --git a/config/products.toml b/config/products.toml
new file mode 100644
index 0000000..c92b879
--- /dev/null
+++ b/config/products.toml
@@ -0,0 +1,5 @@
+[products.doris]
+binary = "doriscli"
+about = "Doris CLI - SQL, profiles, and tablet analysis against a Doris/VeloDB kernel"
+config_dir = ".doris"
+env_prefix = "DORIS"
diff --git a/src/cli/auth.rs b/src/cli/auth.rs
new file mode 100644
index 0000000..d61929a
--- /dev/null
+++ b/src/cli/auth.rs
@@ -0,0 +1,58 @@
+use clap::{Args, Subcommand};
+
+#[derive(Args)]
+pub struct AuthCommand {
+    #[command(subcommand)]
+    pub action: AuthAction,
+}
+
+#[derive(Subcommand)]
+pub enum AuthAction {
+    /// Add a new environment
+    Add(AddArgs),
+
+    /// List all configured environments
+    List,
+
+    /// Test connection and show status
+    Status,
+
+    /// Remove an environment
+    Remove(RemoveArgs),
+}
+
+#[derive(Args)]
+pub struct AddArgs {
+    /// Environment name
+    pub name: String,
+
+    /// MySQL connection URI (mysql://user:pass@host:port). Self-hosted only.
+    #[arg(long)]
+    pub mysql: Option<String>,
+
+    /// Host address (self-hosted)
+    #[arg(long)]
+    pub host: Option<String>,
+
+    /// MySQL port (self-hosted)
+    #[arg(long, default_value = "9030")]
+    pub port: u16,
+
+    /// FE HTTP port (self-hosted)
+    #[arg(long, default_value = "8030")]
+    pub http_port: u16,
+
+    /// Username (self-hosted)
+    #[arg(long)]
+    pub user: Option<String>,
+
+    /// Password (self-hosted). `--mysql-password` is an alias.
+    #[arg(long, alias = "mysql-password")]
+    pub password: Option<String>,
+}
+
+#[derive(Args)]
+pub struct RemoveArgs {
+    /// Environment name to remove
+    pub name: String,
+}
diff --git a/src/cli/mod.rs b/src/cli/mod.rs
new file mode 100644
index 0000000..e397d73
--- /dev/null
+++ b/src/cli/mod.rs
@@ -0,0 +1,7 @@
+pub mod auth;
+pub mod profile;
+pub mod root;
+pub mod sql;
+pub mod tablet;
+
+pub use root::{Cli, Command};
diff --git a/src/cli/profile.rs b/src/cli/profile.rs
new file mode 100644
index 0000000..ba68f52
--- /dev/null
+++ b/src/cli/profile.rs
@@ -0,0 +1,74 @@
+use clap::{Args, Subcommand};
+
+#[derive(Args)]
+pub struct ProfileCommand {
+    #[command(subcommand)]
+    pub action: ProfileAction,
+}
+
+#[derive(Subcommand)]
+pub enum ProfileAction {
+    /// List recent query profiles
+    List(ProfileListArgs),
+
+    /// Get a specific query profile (default: summary + plan + operators + table context)
+    Get(ProfileGetArgs),
+
+    /// Compare two query profiles (slow vs fast run)
+    Diff(ProfileDiffArgs),
+
+    /// Show execution history for a query pattern (from audit_log)
+    History(ProfileHistoryArgs),
+}
+
+#[derive(Args)]
+pub struct ProfileListArgs {
+    /// Maximum number of profiles to return
+    #[arg(long, default_value = "20")]
+    pub limit: usize,
+
+    /// Show currently running queries (from information_schema.active_queries)
+    #[arg(long)]
+    pub active: bool,
+}
+
+#[derive(Args)]
+pub struct ProfileGetArgs {
+    /// Query ID
+    pub query_id: String,
+
+    /// Show full parsed tree (Fragment → Pipeline → Operator with all counters)
+    #[arg(long)]
+    pub full: bool,
+
+    /// Return raw unprocessed profile text
+    #[arg(long)]
+    pub raw: bool,
+
+    /// Load profile text from file (e.g., exported from web UI)
+    #[arg(short, long)]
+    pub file: Option<String>,
+}
+
+#[derive(Args)]
+pub struct ProfileDiffArgs {
+    /// Query ID of the slow run
+    pub slow_qid: String,
+
+    /// Query ID of the fast run
+    pub fast_qid: String,
+}
+
+#[derive(Args)]
+pub struct ProfileHistoryArgs {
+    /// SQL text or substring to match in audit_log
+    pub sql_pattern: String,
+
+    /// Number of days to look back
+    #[arg(long, default_value = "7")]
+    pub days: u32,
+
+    /// Maximum number of entries
+    #[arg(long, default_value = "50")]
+    pub limit: usize,
+}
diff --git a/src/cli/root.rs b/src/cli/root.rs
new file mode 100644
index 0000000..bd951d2
--- /dev/null
+++ b/src/cli/root.rs
@@ -0,0 +1,62 @@
+use crate::output::format::OutputFormatArg;
+use crate::product::ProductProfile;
+use clap::{Args, CommandFactory, FromArgMatches, Parser, Subcommand};
+
+#[derive(Parser)]
+#[command(version, propagate_version = true)]
+pub struct Cli {
+    #[command(subcommand)]
+    pub command: Command,
+
+    /// Authentication environment to use
+    #[arg(long, global = true, default_value = "default")]
+    pub env: String,
+
+    /// Output format (auto-detects: json when piped, table when TTY)
+    #[arg(long, global = true, value_enum)]
+    pub format: Option<OutputFormatArg>,
+
+    /// SOCKS5 proxy in "user:pass@host:port" form (BYOC). Overrides <PREFIX>_SOCKS5_*.
+    #[arg(long, global = true)]
+    pub socks5: Option<String>,
+
+    /// SQL to run immediately after connecting (e.g. `USE @<compute-group>`).
+    /// Overrides DORIS_INIT_SQL. Used for the `cloudcli cloud endpoint` handoff.
+    #[arg(long, global = true)]
+    pub init_sql: Option<String>,
+}
+
+impl Cli {
+    pub fn parse_for(product: &'static ProductProfile) -> Self {
+        let matches = Self::command()
+            .name(product.binary.as_str())
+            .bin_name(product.binary.as_str())
+            .about(product.about.as_str())
+            .get_matches();
+        Self::from_arg_matches(&matches).unwrap_or_else(|e| e.exit())
+    }
+}
+
+#[derive(Args)]
+pub struct UseArgs {
+    /// Environment name to switch to (omit to show current)
+    pub name: Option<String>,
+}
+
+#[derive(Subcommand)]
+pub enum Command {
+    /// Switch active environment
+    Use(UseArgs),
+
+    /// Manage authentication environments
+    Auth(super::auth::AuthCommand),
+
+    /// Execute SQL queries
+    Sql(super::sql::SqlArgs),
+
+    /// Tablet and bucket analysis
+    Tablet(super::tablet::TabletArgs),
+
+    /// Query profile analysis
+    Profile(super::profile::ProfileCommand),
+}
diff --git a/src/cli/sql.rs b/src/cli/sql.rs
new file mode 100644
index 0000000..fbf3643
--- /dev/null
+++ b/src/cli/sql.rs
@@ -0,0 +1,23 @@
+use clap::Args;
+
+#[derive(Args)]
+pub struct SqlArgs {
+    /// SQL query to execute
+    pub query: Option<String>,
+
+    /// Execute SQL from file
+    #[arg(short, long)]
+    pub file: Option<String>,
+
+    /// Enable query profiling (prepends SET enable_profile=true)
+    #[arg(long)]
+    pub profile: bool,
+
+    /// Disable SQL cache for this query (for benchmarking)
+    #[arg(long)]
+    pub no_cache: bool,
+
+    /// SET session variables before query (repeatable: --set "key=value")
+    #[arg(long = "set")]
+    pub set_vars: Vec<String>,
+}
diff --git a/src/cli/tablet.rs b/src/cli/tablet.rs
new file mode 100644
index 0000000..cff1a24
--- /dev/null
+++ b/src/cli/tablet.rs
@@ -0,0 +1,15 @@
+use clap::Args;
+
+#[derive(Args)]
+pub struct TabletArgs {
+    /// Table name (e.g., db.table or just table)
+    pub table: String,
+
+    /// Show detailed distribution: per-partition stats + per-tablet + backend mapping
+    #[arg(long)]
+    pub detail: bool,
+
+    /// Filter by partition name (used with --detail)
+    #[arg(long)]
+    pub partition: Option<String>,
+}
diff --git a/src/commands/auth.rs b/src/commands/auth.rs
new file mode 100644
index 0000000..300fa59
--- /dev/null
+++ b/src/commands/auth.rs
@@ -0,0 +1,284 @@
+use crate::cli::auth::{AddArgs, AuthAction, AuthCommand};
+use crate::config::environment::{EnvironmentConfig, EnvironmentCredentials};
+use crate::config::Store;
+use crate::connection::{HttpConnection, HttpProbe, MysqlConnection, ProbeStatus};
+use serde_json::{json, Value};
+
+pub async fn run(cmd: AuthCommand, store: &mut Store, env_flag: &str) -> anyhow::Result<Value> {
+    match cmd.action {
+        AuthAction::Add(args) => run_add(args, store).await,
+        AuthAction::List => run_list(store),
+        AuthAction::Status => run_status(store, env_flag).await,
+        AuthAction::Remove(args) => run_remove(&args.name, store),
+    }
+}
+
+async fn run_add(args: AddArgs, store: &mut Store) -> anyhow::Result<Value> {
+    let (host, port, user, password) = if let Some(mysql_uri) = &args.mysql {
+        parse_mysql_uri(mysql_uri)?
+    } else if let Some(host) = &args.host {
+        (
+            host.clone(),
+            args.port,
+            args.user.clone().unwrap_or_else(|| "root".to_string()),
+            args.password.clone().unwrap_or_default(),
+        )
+    } else {
+        anyhow::bail!(
+            "Specify --mysql <uri> or --host <host> --user <user> --password <pass>."
+        );
+    };
+
+    let config = EnvironmentConfig {
+        host: host.clone(),
+        mysql_port: port,
+        http_port: args.http_port,
+        user: user.clone(),
+    };
+
+    let creds = EnvironmentCredentials {
+        password: password.clone(),
+    };
+
+    store.add_env(&args.name, config, creds)?;
+
+    // Probe HTTP to surface port/connectivity issues now, not later inside
+    // `profile get`. The store already saved, so probe failures are warnings.
+    let env = store.resolve_env(&args.name)?;
+    let probe = HttpConnection::new(&env).probe().await;
+
+    let mut result = json!({
+        "status": "added",
+        "name": args.name,
+        "host": host,
+        "mysql_port": port,
+        "http_port": args.http_port,
+        "user": user,
+        "http_probe": probe_to_json(&probe),
+    });
+
+    if !probe.any_ok() {
+        // Configured port doesn't respond — try common alternatives before giving up.
+        let mut suggestions: Vec<Value> = Vec::new();
+        for alt in common_http_ports_except(args.http_port) {
+            let alt_probe = HttpConnection::for_target(&env, &host, alt).probe().await;
+            if alt_probe.any_ok() {
+                suggestions.push(json!({
+                    "http_port": alt,
+                    "rest_v2": alt_probe.rest_v2.status.short(),
+                    "legacy": alt_probe.legacy.status.short(),
+                    "fix": format!(
+                        "{bin} auth remove {name} && {bin} auth add {name} --host {host} --user {user} --password '<pass>' --http-port {alt}",
+                        bin = store.product.binary,
+                        name = args.name,
+                        host = host,
+                        user = user,
+                    ),
+                }));
+            }
+        }
+
+        let mut warnings: Vec<String> = vec![format!(
+            "HTTP probe failed on port {}. REST v2: {}; legacy: {}. Profile commands will not work until this is fixed.",
+            args.http_port,
+            probe.rest_v2.status.short(),
+            probe.legacy.status.short(),
+        )];
+        if !suggestions.is_empty() {
+            warnings.push("Another port responded — see http_port_suggestions below.".to_string());
+            result["http_port_suggestions"] = Value::Array(suggestions);
+        }
+        result["warnings"] = json!(warnings);
+    }
+
+    Ok(result)
+}
+
+fn common_http_ports_except(configured: u16) -> Vec<u16> {
+    // 8080: VeloDB Cloud FE HTTP (routed through Stream Load port).
+    // 8030: Apache Doris / self-hosted default.
+    [8080, 8030, 8040]
+        .into_iter()
+        .filter(|p| *p != configured)
+        .collect()
+}
+
+fn probe_to_json(p: &HttpProbe) -> Value {
+    json!({
+        "rest_v2": {
+            "url": p.rest_v2.url,
+            "status": p.rest_v2.status.short(),
+            "ok": matches!(p.rest_v2.status, ProbeStatus::Ok),
+        },
+        "legacy": {
+            "url": p.legacy.url,
+            "status": p.legacy.status.short(),
+            "ok": matches!(p.legacy.status, ProbeStatus::Ok),
+        },
+    })
+}
+
+fn run_list(store: &Store) -> anyhow::Result<Value> {
+    let envs = store.list_envs();
+    let list: Vec<Value> = envs
+        .iter()
+        .map(|(name, config, is_default)| {
+            json!({
+                "name": name,
+                "host": config.host,
+                "port": config.mysql_port,
+                "user": config.user,
+                "type": "self_hosted",
+                "default": is_default,
+            })
+        })
+        .collect();
+
+    if list.is_empty() {
+        Ok(json!({
+            "environments": [],
+            "message": format!(
+                "No environments configured. Run `{} auth add <name> --host <host> --user <user> --password <pass>` to get started.",
+                store.product.binary
+            )
+        }))
+    } else {
+        Ok(Value::Array(list))
+    }
+}
+
+async fn run_status(store: &Store, env_flag: &str) -> anyhow::Result<Value> {
+    let env_name = store.effective_env_name(env_flag);
+    let (source, source_detail) = store.effective_env_source(env_flag);
+    let env = store.resolve_env(&env_name)?;
+
+    let all_envs: Vec<String> = store
+        .list_envs()
+        .iter()
+        .map(|(n, _, _)| n.clone())
+        .collect();
+
+    let mut result = json!({
+        "environment": env_name,
+        "source": source,
+        "source_detail": source_detail,
+        "all_environments": all_envs,
+        "type": "self_hosted",
+        "host": env.host,
+        "mysql_port": env.mysql_port,
+        "http_port": env.http_port,
+        "user": env.user,
+    });
+
+    // Test MySQL connection + gather cluster info
+    match MysqlConnection::connect(&env).await {
+        Ok(mut conn) => match conn.ping().await {
+            Ok(latency) => {
+                result["mysql_status"] = json!("connected");
+                result["mysql_latency_ms"] = json!(latency);
+
+                if let Ok(ver) = conn.query("SELECT VERSION() as v").await {
+                    if let Some(v) = ver.rows.first().and_then(|r| r.get("v")) {
+                        result["doris_version"] = v.clone();
+                    }
+                }
+
+                if let Ok(bes) = conn.query("SHOW BACKENDS").await {
+                    let backends: Vec<Value> = bes.rows.iter().map(|row| {
+                        json!({
+                            "id": row.get("BackendId").or_else(|| row.get("backend_id")),
+                            "host": row.get("Host").or_else(|| row.get("IP")).and_then(|v| v.as_str()),
+                            "alive": row.get("Alive").and_then(|v| v.as_str()).map(|s| s == "true"),
+                        })
+                    }).collect();
+                    result["backends"] = json!(backends);
+                }
+
+                if let Ok(wgs) = conn.query("SHOW WORKLOAD GROUPS").await {
+                    let groups: Vec<Value> = wgs
+                        .rows
+                        .iter()
+                        .map(|row| {
+                            json!({
+                                "name": row.get("Name").and_then(|v| v.as_str()),
+                                "running": row.get("running_query_num"),
+                                "waiting": row.get("waiting_query_num"),
+                            })
+                        })
+                        .collect();
+                    result["workload_groups"] = json!(groups);
+                }
+
+                if let Ok(vars) = conn.query("SELECT COUNT(*) as cnt FROM information_schema.session_variables WHERE CHANGED = 1").await {
+                    if let Some(cnt) = vars.rows.first().and_then(|r| r.get("cnt")) {
+                        result["changed_session_vars"] = cnt.clone();
+                    }
+                }
+            }
+            Err(e) => {
+                result["mysql_status"] = json!(format!("error: {e}"));
+            }
+        },
+        Err(e) => {
+            result["mysql_status"] = json!(format!("error: {e}"));
+        }
+    }
+
+    // HTTP health — profile features need this.
+    let probe = HttpConnection::new(&env).probe().await;
+    result["http_status"] = if probe.any_ok() {
+        json!("connected")
+    } else {
+        json!("unreachable")
+    };
+    result["http_probe"] = probe_to_json(&probe);
+
+    Ok(result)
+}
+
+fn run_remove(name: &str, store: &mut Store) -> anyhow::Result<Value> {
+    store.remove_env(name)?;
+    Ok(json!({
+        "status": "removed",
+        "name": name,
+    }))
+}
+
+/// Parse a MySQL URI like mysql://user:pass@host:port/db
+fn parse_mysql_uri(uri: &str) -> anyhow::Result<(String, u16, String, String)> {
+    let uri = uri
+        .strip_prefix("mysql://")
+        .ok_or_else(|| anyhow::anyhow!("MySQL URI must start with mysql://"))?;
+
+    let (userinfo, hostport) = if let Some(at_pos) = uri.rfind('@') {
+        (&uri[..at_pos], &uri[at_pos + 1..])
+    } else {
+        ("root:", uri)
+    };
+
+    // Strip database path if present
+    let hostport = hostport.split('/').next().unwrap_or(hostport);
+
+    let (user, password) = if let Some(colon) = userinfo.find(':') {
+        (&userinfo[..colon], &userinfo[colon + 1..])
+    } else {
+        (userinfo, "")
+    };
+
+    let (host, port) = if let Some(colon) = hostport.rfind(':') {
+        let port_str = &hostport[colon + 1..];
+        let port: u16 = port_str
+            .parse()
+            .map_err(|_| anyhow::anyhow!("Invalid port: {port_str}"))?;
+        (&hostport[..colon], port)
+    } else {
+        (hostport, 9030u16)
+    };
+
+    Ok((
+        host.to_string(),
+        port,
+        user.to_string(),
+        password.to_string(),
+    ))
+}
diff --git a/src/commands/mod.rs b/src/commands/mod.rs
new file mode 100644
index 0000000..9ebaf40
--- /dev/null
+++ b/src/commands/mod.rs
@@ -0,0 +1,5 @@
+pub mod auth;
+pub mod profile;
+pub mod sql;
+pub mod tablet;
+pub mod use_env;
diff --git a/src/commands/profile/diff.rs b/src/commands/profile/diff.rs
new file mode 100644
index 0000000..e0431e3
--- /dev/null
+++ b/src/commands/profile/diff.rs
@@ -0,0 +1,123 @@
+use crate::config::Environment;
+use crate::parser::profile_parser;
+use serde_json::{json, Value};
+
+/// Compare two profiles: which operators got slower, where rows exploded, where skew appeared.
+pub async fn run(slow_qid: &str, fast_qid: &str, env: &Environment) -> anyhow::Result<Value> {
+    // Fetch both profiles — diff inherits fan-out across FEs automatically.
+    let slow_fetched = super::fetch::fetch_profile_text(slow_qid, env)
+        .await
+        .map_err(|e| anyhow::anyhow!("{e}"))?;
+    let fast_fetched = super::fetch::fetch_profile_text(fast_qid, env)
+        .await
+        .map_err(|e| anyhow::anyhow!("{e}"))?;
+
+    let slow_profile = profile_parser::parse(&slow_fetched.text);
+    let fast_profile = profile_parser::parse(&fast_fetched.text);
+
+    let slow_ops = profile_parser::flatten_operators(&slow_profile);
+    let fast_ops = profile_parser::flatten_operators(&fast_profile);
+
+    let slow_total_ms = slow_profile.summary.total_time_ms.unwrap_or(0.0);
+    let fast_total_ms = fast_profile.summary.total_time_ms.unwrap_or(0.0);
+    let time_ratio = if fast_total_ms > 0.0 {
+        slow_total_ms / fast_total_ms
+    } else {
+        0.0
+    };
+
+    // Match operators by name+fragment for comparison
+    let mut operator_diffs = Vec::new();
+
+    for slow_op in &slow_ops {
+        // Find matching operator in fast run (by name and fragment)
+        let fast_op = fast_ops.iter().find(|f| {
+            f.name == slow_op.name && f.frag == slow_op.frag && f.pipeline == slow_op.pipeline
+        });
+
+        if let Some(fast_op) = fast_op {
+            let time_delta_ms = slow_op.exec_time_avg_ms - fast_op.exec_time_avg_ms;
+            let time_ratio_op = if fast_op.exec_time_avg_ms > 0.0 {
+                slow_op.exec_time_avg_ms / fast_op.exec_time_avg_ms
+            } else {
+                0.0
+            };
+
+            let rows_delta = match (slow_op.input_rows, fast_op.input_rows) {
+                (Some(s), Some(f)) if f > 0.0 => Some(round2(s / f)),
+                _ => None,
+            };
+
+            let skew_delta = match (slow_op.skew_ratio, fast_op.skew_ratio) {
+                (Some(s), Some(f)) => Some(round2(s - f)),
+                _ => None,
+            };
+
+            // Only include operators with meaningful differences
+            let significant = time_delta_ms.abs() > 1.0
+                || rows_delta.map(|r| (r - 1.0).abs() > 0.1).unwrap_or(false)
+                || skew_delta.map(|s| s.abs() > 0.5).unwrap_or(false);
+
+            if significant {
+                operator_diffs.push(json!({
+                    "name": slow_op.name,
+                    "frag": slow_op.frag,
+                    "slow_ms": slow_op.exec_time_avg_ms,
+                    "fast_ms": fast_op.exec_time_avg_ms,
+                    "time_delta_ms": round2(time_delta_ms),
+                    "time_ratio": round2(time_ratio_op),
+                    "rows_ratio": rows_delta,
+                    "skew_delta": skew_delta,
+                    "slow_selectivity": slow_op.selectivity,
+                    "fast_selectivity": fast_op.selectivity,
+                    "slow_spilled": slow_op.spilled,
+                    "fast_spilled": fast_op.spilled,
+                }));
+            }
+        } else if slow_op.exec_time_avg_ms > 1.0 {
+            // Operator exists only in slow run
+            operator_diffs.push(json!({
+                "name": slow_op.name,
+                "frag": slow_op.frag,
+                "slow_ms": slow_op.exec_time_avg_ms,
+                "fast_ms": null,
+                "time_delta_ms": slow_op.exec_time_avg_ms,
+                "note": "only in slow run",
+            }));
+        }
+    }
+
+    // Sort by time_delta descending (biggest regressions first)
+    operator_diffs.sort_by(|a, b| {
+        let da = a
+            .get("time_delta_ms")
+            .and_then(|v| v.as_f64())
+            .unwrap_or(0.0);
+        let db = b
+            .get("time_delta_ms")
+            .and_then(|v| v.as_f64())
+            .unwrap_or(0.0);
+        db.partial_cmp(&da).unwrap_or(std::cmp::Ordering::Equal)
+    });
+
+    Ok(json!({
+        "slow": {
+            "query_id": slow_qid,
+            "total_time_ms": slow_total_ms,
+            "total_time": slow_profile.summary.total_time,
+            "operator_count": slow_ops.len(),
+        },
+        "fast": {
+            "query_id": fast_qid,
+            "total_time_ms": fast_total_ms,
+            "total_time": fast_profile.summary.total_time,
+            "operator_count": fast_ops.len(),
+        },
+        "time_ratio": round2(time_ratio),
+        "operator_diffs": operator_diffs,
+    }))
+}
+
+fn round2(v: f64) -> f64 {
+    (v * 100.0).round() / 100.0
+}
diff --git a/src/commands/profile/fetch.rs b/src/commands/profile/fetch.rs
new file mode 100644
index 0000000..e1698ba
--- /dev/null
+++ b/src/commands/profile/fetch.rs
@@ -0,0 +1,188 @@
+use crate::config::Environment;
+use crate::connection::{HttpConnection, MysqlConnection};
+use serde_json::{json, Value};
+use std::fmt;
+
+/// One attempt to fetch a profile via a specific API.
+/// Collected so `profile get` can tell the user *why* a fetch failed instead
+/// of swallowing errors behind a generic "not accessible" note.
+#[derive(Debug, Clone)]
+pub struct FetchAttempt {
+    pub target: String,    // "host:port"
+    pub via: &'static str, // "rest_v2" | "legacy"
+    pub result: String,    // "ok" or error description
+}
+
+impl FetchAttempt {
+    pub fn to_json(&self) -> Value {
+        json!({
+            "target": self.target,
+            "via": self.via,
+            "result": self.result,
+        })
+    }
+}
+
+/// Successful profile fetch — text plus metadata about how we got it.
+pub struct ProfileFetch {
+    pub text: String,
+    pub served_by: String,
+    pub via: &'static str,
+    pub attempts: Vec<FetchAttempt>,
+}
+
+/// Failure across all APIs attempted. Carries the full attempt log.
+#[derive(Debug)]
+pub struct FetchFailure {
+    pub query_id: String,
+    pub binary: String,
+    pub attempts: Vec<FetchAttempt>,
+}
+
+impl FetchFailure {
+    pub fn attempts_json(&self) -> Value {
+        Value::Array(self.attempts.iter().map(FetchAttempt::to_json).collect())
+    }
+}
+
+impl fmt::Display for FetchFailure {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        write!(
+            f,
+            "Could not fetch profile '{}'.\n\
+             REST v2 with is_all_node=true aggregates profiles across FEs server-side,\n\
+             so this usually means the HTTP port is wrong or the profile has been evicted.\n\
+             VeloDB Cloud uses --http-port 8080; self-hosted Doris uses 8030.\n\
+             Run `{} auth status` to check connectivity.\n\
+             Attempts:\n{}",
+            self.query_id,
+            self.binary,
+            self.attempts
+                .iter()
+                .map(|a| format!("  - {} via {}: {}", a.target, a.via, a.result))
+                .collect::<Vec<_>>()
+                .join("\n"),
+        )
+    }
+}
+
+impl std::error::Error for FetchFailure {}
+
+/// Fetch profile text from the configured FE.
+///
+/// Tries REST v2 first (which server-side aggregates across FEs via
+/// `is_all_node=true`), then falls back to the legacy `/api/profile/text/`
+/// endpoint for older Doris versions. Every attempt is recorded so the
+/// caller can surface a specific reason for failure.
+pub async fn fetch_profile_text(
+    query_id: &str,
+    env: &Environment,
+) -> Result<ProfileFetch, FetchFailure> {
+    let mut attempts: Vec<FetchAttempt> = Vec::new();
+    let target = format!("{}:{}", env.host, env.http_port);
+    let conn = HttpConnection::new(env);
+
+    if let Some((text, via)) = try_fetch(&conn, &target, query_id, &mut attempts).await {
+        return Ok(ProfileFetch {
+            text,
+            served_by: target,
+            via,
+            attempts,
+        });
+    }
+
+    Err(FetchFailure {
+        query_id: query_id.to_string(),
+        binary: env.product.binary.clone(),
+        attempts,
+    })
+}
+
+/// Try REST v2 then legacy on one connection. Returns (text, via) on first success.
+async fn try_fetch(
+    conn: &HttpConnection,
+    target: &str,
+    query_id: &str,
+    attempts: &mut Vec<FetchAttempt>,
+) -> Option<(String, &'static str)> {
+    match conn.get_profile_text_v2(query_id).await {
+        Ok(text) if !text.is_empty() && text.contains("Summary") => {
+            attempts.push(FetchAttempt {
+                target: target.to_string(),
+                via: "rest_v2",
+                result: "ok".to_string(),
+            });
+            return Some((text, "rest_v2"));
+        }
+        Ok(_) => {
+            attempts.push(FetchAttempt {
+                target: target.to_string(),
+                via: "rest_v2",
+                result: "empty or malformed response".to_string(),
+            });
+        }
+        Err(e) => {
+            attempts.push(FetchAttempt {
+                target: target.to_string(),
+                via: "rest_v2",
+                result: format!("{e}"),
+            });
+        }
+    }
+
+    match conn.get_profile_text(query_id).await {
+        Ok(text) if !text.is_empty() && text.contains("Summary") => {
+            attempts.push(FetchAttempt {
+                target: target.to_string(),
+                via: "legacy",
+                result: "ok".to_string(),
+            });
+            return Some((text, "legacy"));
+        }
+        Ok(_) => {
+            attempts.push(FetchAttempt {
+                target: target.to_string(),
+                via: "legacy",
+                result: "empty or non-profile body".to_string(),
+            });
+        }
+        Err(e) => {
+            attempts.push(FetchAttempt {
+                target: target.to_string(),
+                via: "legacy",
+                result: format!("{e}"),
+            });
+        }
+    }
+
+    None
+}
+
+/// Build a basic summary from SHOW QUERY PROFILE list metadata.
+/// This works even when the full profile text isn't accessible.
+pub async fn fetch_summary_from_sql(
+    query_id: &str,
+    env: &Environment,
+) -> anyhow::Result<Option<Value>> {
+    let mut conn = MysqlConnection::connect(env).await?;
+    let result = conn.query("SHOW QUERY PROFILE '/'").await?;
+
+    for row in &result.rows {
+        let pid = row.get("Profile ID").and_then(|v| v.as_str()).unwrap_or("");
+
+        if pid == query_id {
+            return Ok(Some(json!({
+                "query_id": pid,
+                "sql": row.get("Sql Statement").and_then(|v| v.as_str()).unwrap_or(""),
+                "total_time": row.get("Total").and_then(|v| v.as_str()).unwrap_or(""),
+                "state": row.get("Task State").and_then(|v| v.as_str()).unwrap_or(""),
+                "user": row.get("User").and_then(|v| v.as_str()).unwrap_or(""),
+                "start_time": row.get("Start Time").and_then(|v| v.as_str()).unwrap_or(""),
+                "end_time": row.get("End Time").and_then(|v| v.as_str()).unwrap_or(""),
+                "default_db": row.get("Default Db").and_then(|v| v.as_str()).unwrap_or(""),
+            })));
+        }
+    }
+
+    Ok(None)
+}
diff --git a/src/commands/profile/full.rs b/src/commands/profile/full.rs
new file mode 100644
index 0000000..a7c2ef1
--- /dev/null
+++ b/src/commands/profile/full.rs
@@ -0,0 +1,277 @@
+use crate::config::Environment;
+use crate::connection::MysqlConnection;
+use crate::parser::{profile_parser, section_parser};
+use serde_json::{json, Value};
+
+/// --full: Complete diagnostic snapshot.
+/// - profile: full parsed tree (fragments → pipelines → operators with all_counters)
+/// - operators: flattened with diagnostic fields (selectivity, spill, shuffle, cache, wait)
+/// - physical_plan: query plan text
+/// - scanned_tables: DDL + column_stats + tablet health per table
+/// - cluster: backends, workload groups, live session variables
+pub async fn run(
+    query_id: &str,
+    profile_text: Option<&str>,
+    env: &Environment,
+) -> anyhow::Result<Value> {
+    let (text, served_by, via, attempts) = if let Some(t) = profile_text {
+        (t.to_string(), None, None, Vec::new())
+    } else {
+        let fetched = super::fetch::fetch_profile_text(query_id, env)
+            .await
+            .map_err(|e| anyhow::anyhow!("{e}"))?;
+        (
+            fetched.text,
+            Some(fetched.served_by),
+            Some(fetched.via),
+            fetched.attempts,
+        )
+    };
+
+    let profile = profile_parser::parse(&text);
+    let flat_ops = profile_parser::flatten_operators(&profile);
+
+    // Physical plan
+    let normalized = section_parser::normalize_text(&text);
+    let sections = section_parser::split_sections(&normalized);
+
+    // Extract scanned table names
+    let scanned_tables: Vec<String> = flat_ops
+        .iter()
+        .filter_map(|op| op.table.as_ref())
+        .map(|t| t.split('(').next().unwrap_or(t).trim().to_string())
+        .filter(|t| !t.is_empty())
+        .collect::<std::collections::BTreeSet<_>>()
+        .into_iter()
+        .collect();
+
+    // Gather all table context + cluster info via connection
+    let mut table_context: serde_json::Map<String, Value> = serde_json::Map::new();
+    let mut cluster = json!(null);
+
+    if let Ok(mut conn) = MysqlConnection::connect(env).await {
+        // USE database from table names
+        let db_to_use = profile
+            .summary
+            .default_db
+            .as_deref()
+            .filter(|s| !s.is_empty())
+            .or_else(|| {
+                scanned_tables
+                    .iter()
+                    .find(|t| t.contains('.'))
+                    .and_then(|t| t.split('.').next())
+            });
+        if let Some(db) = db_to_use {
+            let _ = conn.exec(&format!("USE `{db}`")).await;
+        }
+
+        // ── Scanned table DDLs + tablet health ──
+        for table in &scanned_tables {
+            let mut entry = json!({});
+            let tbl_name = table.split('.').last().unwrap_or(table);
+
+            // DDL (full CREATE TABLE)
+            let ddl_queries = if table.contains('.') {
+                let parts: Vec<&str> = table.split('.').collect();
+                vec![
+                    format!("SHOW CREATE TABLE `{}`.`{}`", parts[0], parts[1]),
+                    format!("SHOW CREATE TABLE `{}`", parts.last().unwrap_or(&"")),
+                ]
+            } else {
+                vec![format!("SHOW CREATE TABLE `{table}`")]
+            };
+
+            for ddl_sql in &ddl_queries {
+                if let Ok(ddl_result) = conn.query(ddl_sql).await {
+                    if let Some(ddl) = ddl_result
+                        .rows
+                        .first()
+                        .and_then(|r| r.get("Create Table"))
+                        .and_then(|v| v.as_str())
+                    {
+                        entry["ddl"] = Value::String(ddl.to_string());
+                        break;
+                    }
+                }
+            }
+
+            // Column stats
+            if let Ok(stats) = conn.query(&format!("SHOW COLUMN STATS `{tbl_name}`")).await {
+                let cols: Vec<Value> = stats
+                    .rows
+                    .iter()
+                    .map(|r| {
+                        json!({
+                            "column": r.get("column_name").and_then(|v| v.as_str()),
+                            "ndv": r.get("ndv").and_then(|v| v.as_f64().or_else(|| v.as_str().and_then(|s| s.parse().ok()))),
+                            "count": r.get("count").and_then(|v| v.as_f64().or_else(|| v.as_str().and_then(|s| s.parse().ok()))),
+                            "null_count": r.get("num_null").and_then(|v| v.as_f64().or_else(|| v.as_str().and_then(|s| s.parse().ok()))),
+                            "min": r.get("min").and_then(|v| v.as_str()),
+                            "max": r.get("max").and_then(|v| v.as_str()),
+                        })
+                    })
+                    .collect();
+                if !cols.is_empty() {
+                    entry["column_stats"] = Value::Array(cols);
+                }
+            }
+
+            // Tablet health (DATA SKEW)
+            if let Ok(skew) = conn
+                .query(&format!("SHOW DATA SKEW FROM `{tbl_name}`"))
+                .await
+            {
+                let mut sizes: Vec<f64> = Vec::new();
+                let mut total_rows: u64 = 0;
+                for row in &skew.rows {
+                    let size = row
+                        .get("AvgDataSize")
+                        .and_then(|v| {
+                            v.as_u64()
+                                .or_else(|| v.as_str().and_then(|s| s.parse().ok()))
+                        })
+                        .unwrap_or(0) as f64;
+                    sizes.push(size);
+                    total_rows += row
+                        .get("AvgRowCount")
+                        .and_then(|v| {
+                            v.as_u64()
+                                .or_else(|| v.as_str().and_then(|s| s.parse().ok()))
+                        })
+                        .unwrap_or(0);
+                }
+                if !sizes.is_empty() {
+                    let avg = sizes.iter().sum::<f64>() / sizes.len() as f64;
+                    let max = sizes.iter().cloned().fold(f64::NEG_INFINITY, f64::max);
+                    let total: f64 = sizes.iter().sum();
+                    entry["tablets"] = json!(sizes.len());
+                    entry["total_rows"] = json!(total_rows);
+                    entry["total_size_gb"] = json!(round2(total / (1024.0 * 1024.0 * 1024.0)));
+                    entry["tablet_skew"] = json!(round1(if avg > 0.0 { max / avg } else { 1.0 }));
+                }
+            }
+
+            // Partitions
+            if let Ok(parts) = conn
+                .query(&format!("SHOW PARTITIONS FROM `{tbl_name}`"))
+                .await
+            {
+                entry["partition_count"] = json!(parts.rows.len());
+            }
+
+            table_context.insert(table.clone(), entry);
+        }
+
+        // ── Cluster state ──
+        let mut cluster_info = json!({});
+
+        // Backends
+        if let Ok(bes) = conn.query("SHOW BACKENDS").await {
+            let backends: Vec<Value> = bes
+                .rows
+                .iter()
+                .map(|row| {
+                    json!({
+                        "id": row.get("BackendId").or_else(|| row.get("backend_id")),
+                        "host": row.get("Host").or_else(|| row.get("IP")).and_then(|v| v.as_str()),
+                        "alive": row.get("Alive").and_then(|v| v.as_str()).map(|s| s == "true"),
+                    })
+                })
+                .collect();
+            cluster_info["backends"] = Value::Array(backends);
+        }
+
+        // Workload groups
+        if let Ok(wgs) = conn.query("SHOW WORKLOAD GROUPS").await {
+            let groups: Vec<Value> = wgs
+                .rows
+                .iter()
+                .map(|row| {
+                    json!({
+                        "name": row.get("Name").and_then(|v| v.as_str()),
+                        "max_cpu": row.get("max_cpu_percent").and_then(|v| v.as_str()),
+                        "max_memory": row.get("max_memory_percent").and_then(|v| v.as_str()),
+                        "running": row.get("running_query_num"),
+                        "waiting": row.get("waiting_query_num"),
+                    })
+                })
+                .collect();
+            cluster_info["workload_groups"] = Value::Array(groups);
+        }
+
+        // Version
+        if let Ok(ver) = conn.query("SELECT VERSION() as v").await {
+            if let Some(v) = ver.rows.first().and_then(|r| r.get("v")) {
+                cluster_info["doris_version"] = v.clone();
+            }
+        }
+
+        // All non-default session vars
+        if let Ok(vars) = conn
+            .query("SELECT VARIABLE_NAME, VARIABLE_VALUE, DEFAULT_VALUE FROM information_schema.session_variables WHERE CHANGED = 1")
+            .await
+        {
+            let all_vars: Vec<Value> = vars
+                .rows
+                .iter()
+                .map(|r| {
+                    let name = r.get("VARIABLE_NAME").and_then(|v| v.as_str()).unwrap_or("");
+                    json!({
+                        "name": name,
+                        "value": r.get("VARIABLE_VALUE").and_then(|v| v.as_str()),
+                        "default": r.get("DEFAULT_VALUE").and_then(|v| v.as_str()),
+                        "impact": super::summary::classify_var_impact(name),
+                    })
+                })
+                .collect();
+            cluster_info["session_variables"] = Value::Array(all_vars);
+        }
+
+        cluster = cluster_info;
+    }
+
+    // ── Build full response ──
+    let all_ops: Vec<Value> = flat_ops
+        .iter()
+        .map(|op| serde_json::to_value(op).unwrap_or(Value::Null))
+        .collect();
+
+    let mut result = json!({
+        "profile": serde_json::to_value(&profile)?,
+        "operators": all_ops,
+    });
+
+    if let Some(plan) = sections.get("Physical Plan") {
+        result["physical_plan"] = Value::String(plan.clone());
+    }
+    if !table_context.is_empty() {
+        result["scanned_tables"] = Value::Object(table_context);
+    }
+    if cluster != Value::Null {
+        result["cluster"] = cluster;
+    }
+
+    // Provenance: which FE served this profile, how we got it, and what we tried.
+    // Helpful for debugging multi-FE clusters where only one FE has the profile.
+    if let Some(sb) = served_by {
+        result["served_by"] = Value::String(sb);
+    }
+    if let Some(v) = via {
+        result["fetch_via"] = Value::String(v.to_string());
+    }
+    if !attempts.is_empty() {
+        let attempts_json: Vec<Value> = attempts.iter().map(|a| a.to_json()).collect();
+        result["fetch_attempts"] = Value::Array(attempts_json);
+    }
+
+    Ok(result)
+}
+
+fn round1(v: f64) -> f64 {
+    (v * 10.0).round() / 10.0
+}
+
+fn round2(v: f64) -> f64 {
+    (v * 100.0).round() / 100.0
+}
diff --git a/src/commands/profile/history.rs b/src/commands/profile/history.rs
new file mode 100644
index 0000000..5c45730
--- /dev/null
+++ b/src/commands/profile/history.rs
@@ -0,0 +1,152 @@
+use crate::config::Environment;
+use crate::connection::MysqlConnection;
+use serde_json::{json, Value};
+
+/// Show execution history for a query pattern from __internal_schema.audit_log.
+/// Provides trend analysis: p50/p99 latency, degradation detection.
+pub async fn run(
+    sql_pattern: &str,
+    days: u32,
+    limit: usize,
+    env: &Environment,
+) -> anyhow::Result<Value> {
+    let mut conn = MysqlConnection::connect(env).await?;
+
+    // Escape single quotes in pattern for SQL safety
+    let safe_pattern = sql_pattern.replace('\'', "''");
+
+    // Query audit_log for matching queries
+    let sql = format!(
+        "SELECT \
+            query_id, \
+            stmt AS sql_text, \
+            query_time AS query_time_ms, \
+            scan_bytes, \
+            scan_rows, \
+            return_rows, \
+            shuffle_send_bytes, \
+            peak_memory_bytes, \
+            cpu_time_ms, \
+            `time` AS exec_time, \
+            state \
+         FROM `__internal_schema`.`audit_log` \
+         WHERE stmt LIKE '%{safe_pattern}%' \
+           AND `time` >= DATE_SUB(NOW(), INTERVAL {days} DAY) \
+           AND state != 'ERR' \
+         ORDER BY `time` DESC \
+         LIMIT {limit}"
+    );
+
+    let result = match conn.query(&sql).await {
+        Ok(r) => r,
+        Err(e) => {
+            // audit_log may not be accessible
+            anyhow::bail!(
+                "Cannot query audit_log: {e}\n\
+                 The __internal_schema.audit_log table may not be enabled on this cluster."
+            );
+        }
+    };
+
+    if result.rows.is_empty() {
+        return Ok(json!({
+            "pattern": sql_pattern,
+            "days": days,
+            "executions": 0,
+            "entries": [],
+            "note": "No matching queries found in audit_log"
+        }));
+    }
+
+    // Compute aggregate statistics
+    let mut query_times: Vec<f64> = Vec::new();
+    let mut scan_bytes_total: f64 = 0.0;
+    let mut peak_mem_total: f64 = 0.0;
+
+    let entries: Vec<Value> = result
+        .rows
+        .iter()
+        .map(|row| {
+            let qt = row
+                .get("query_time_ms")
+                .and_then(|v| {
+                    v.as_f64()
+                        .or_else(|| v.as_str().and_then(|s| s.parse().ok()))
+                })
+                .unwrap_or(0.0);
+            query_times.push(qt);
+
+            let sb = row
+                .get("scan_bytes")
+                .and_then(|v| {
+                    v.as_f64()
+                        .or_else(|| v.as_str().and_then(|s| s.parse().ok()))
+                })
+                .unwrap_or(0.0);
+            scan_bytes_total += sb;
+
+            let pm = row
+                .get("peak_memory_bytes")
+                .and_then(|v| {
+                    v.as_f64()
+                        .or_else(|| v.as_str().and_then(|s| s.parse().ok()))
+                })
+                .unwrap_or(0.0);
+            peak_mem_total += pm;
+
+            json!({
+                "query_id": row.get("query_id").and_then(|v| v.as_str()).unwrap_or(""),
+                "exec_time": row.get("exec_time").and_then(|v| v.as_str()).unwrap_or(""),
+                "query_time_ms": qt,
+                "scan_bytes": sb as u64,
+                "scan_rows": row.get("scan_rows").and_then(|v| v.as_u64()),
+                "return_rows": row.get("return_rows").and_then(|v| v.as_u64()),
+                "peak_memory_bytes": pm as u64,
+                "state": row.get("state").and_then(|v| v.as_str()).unwrap_or(""),
+            })
+        })
+        .collect();
+
+    // Compute percentiles
+    query_times.sort_by(|a, b| a.partial_cmp(b).unwrap_or(std::cmp::Ordering::Equal));
+    let count = query_times.len();
+    let p50 = if count > 0 {
+        query_times[count / 2]
+    } else {
+        0.0
+    };
+    let p99 = if count > 0 {
+        query_times[(count as f64 * 0.99) as usize].min(*query_times.last().unwrap_or(&0.0))
+    } else {
+        0.0
+    };
+    let avg = if count > 0 {
+        query_times.iter().sum::<f64>() / count as f64
+    } else {
+        0.0
+    };
+    let min = query_times.first().copied().unwrap_or(0.0);
+    let max = query_times.last().copied().unwrap_or(0.0);
+
+    Ok(json!({
+        "pattern": sql_pattern,
+        "days": days,
+        "executions": count,
+        "stats": {
+            "query_time_ms": {
+                "avg": round1(avg),
+                "min": round1(min),
+                "max": round1(max),
+                "p50": round1(p50),
+                "p99": round1(p99),
+            },
+            "avg_scan_bytes": round1(scan_bytes_total / count as f64),
+            "avg_peak_memory_bytes": round1(peak_mem_total / count as f64),
+        },
+        "entries": entries,
+    }))
+}
+
+fn round1(v: f64) -> f64 {
+    (v * 10.0).round() / 10.0
+}
diff --git a/src/commands/profile/list.rs b/src/commands/profile/list.rs
new file mode 100644
index 0000000..369509b
--- /dev/null
+++ b/src/commands/profile/list.rs
@@ -0,0 +1,88 @@
+use crate::config::Environment;
+use crate::connection::MysqlConnection;
+use serde_json::{json, Value};
+
+pub async fn run(limit: usize, env: &Environment) -> anyhow::Result<Value> {
+    let mut conn = MysqlConnection::connect(env).await?;
+
+    let result = conn.query("SHOW QUERY PROFILE '/'").await?;
+
+    let profiles: Vec<Value> = result
+        .rows
+        .iter()
+        .take(limit)
+        .map(|row| {
+            let sql = row
+                .get("Sql Statement")
+                .and_then(|v| v.as_str())
+                .unwrap_or("");
+
+            // Truncate SQL for display
+            let sql_truncated = if sql.len() > 120 {
+                format!("{}...", &sql[..120])
+            } else {
+                sql.to_string()
+            };
+
+            // Clean up escaped newlines and collapse whitespace
+            let sql_clean = sql_truncated
+                .replace("\\n", " ")
+                .split_whitespace()
+                .collect::<Vec<_>>()
+                .join(" ");
+
+            json!({
+                "query_id": row.get("Profile ID").and_then(|v| v.as_str()).unwrap_or(""),
+                "sql": sql_clean,
+                "total_time": row.get("Total").and_then(|v| v.as_str()).unwrap_or(""),
+                "state": row.get("Task State").and_then(|v| v.as_str()).unwrap_or(""),
+                "user": row.get("User").and_then(|v| v.as_str()).unwrap_or(""),
+                "start_time": row.get("Start Time").and_then(|v| v.as_str()).unwrap_or(""),
+                "default_db": row.get("Default Db").and_then(|v| v.as_str()).unwrap_or(""),
+            })
+        })
+        .collect();
+
+    Ok(Value::Array(profiles))
+}
+
+/// List currently running queries via information_schema.active_queries.
+pub async fn run_active(env: &Environment) -> anyhow::Result<Value> {
+    let mut conn = MysqlConnection::connect(env).await?;
+
+    let result = conn
+        .query(
+            "SELECT * FROM information_schema.active_queries \
+             ORDER BY QUERY_TIME_MS DESC",
+        )
+        .await?;
+
+    let queries: Vec<Value> = result
+        .rows
+        .iter()
+        .map(|row| {
+            let sql = row.get("SQL").and_then(|v| v.as_str()).unwrap_or("");
+            let sql_truncated = if sql.len() > 120 {
+                format!("{}...", &sql[..120])
+            } else {
+                sql.to_string()
+            };
+            let sql_clean = sql_truncated
+                .split_whitespace()
+                .collect::<Vec<_>>()
+                .join(" ");
+
+            json!({
+                "query_id": row.get("QUERY_ID").and_then(|v| v.as_str()).unwrap_or(""),
+                "sql": sql_clean,
+                "running_ms": row.get("QUERY_TIME_MS").and_then(|v| v.as_u64()),
+                "user": row.get("USER").and_then(|v| v.as_str()).unwrap_or(""),
+                "database": row.get("DATABASE").and_then(|v| v.as_str()).unwrap_or(""),
+                "start_time": row.get("QUERY_START_TIME").and_then(|v| v.as_str()).unwrap_or(""),
+                "workload_group_id": row.get("WORKLOAD_GROUP_ID").and_then(|v| v.as_u64()),
+            })
+        })
+        .collect();
+
+    Ok(Value::Array(queries))
+}
diff --git a/src/commands/profile/mod.rs b/src/commands/profile/mod.rs
new file mode 100644
index 0000000..abe4512
--- /dev/null
+++ b/src/commands/profile/mod.rs
@@ -0,0 +1,51 @@
+pub mod diff;
+pub mod fetch;
+pub mod full;
+pub mod history;
+pub mod list;
+pub mod summary;
+
+use crate::cli::profile::{ProfileAction, ProfileCommand};
+use crate::config::Environment;
+use serde_json::Value;
+
+pub async fn run(cmd: ProfileCommand, env: &Environment) -> anyhow::Result<Value> {
+    match cmd.action {
+        ProfileAction::List(args) => {
+            if args.active {
+                list::run_active(env).await
+            } else {
+                list::run(args.limit, env).await
+            }
+        }
+        ProfileAction::Get(args) => {
+            let profile_source = if let Some(file) = &args.file {
+                Some(std::fs::read_to_string(file).map_err(|e| {
+                    anyhow::anyhow!("Failed to read profile file '{file}': {e}")
+                })?)
+            } else {
+                None
+            };
+
+            if args.raw {
+                if let Some(text) = profile_source {
+                    Ok(Value::String(text))
+                } else {
+                    let fetched = fetch::fetch_profile_text(&args.query_id, env)
+                        .await
+                        .map_err(|e| anyhow::anyhow!("{e}"))?;
+                    Ok(Value::String(fetched.text))
+                }
+            } else if args.full {
+                full::run(&args.query_id, profile_source.as_deref(), env).await
+            } else {
+                // Default: summary + ALL operators + DDL + fragments + health
+                summary::run(&args.query_id, profile_source.as_deref(), env).await
+            }
+        }
+        ProfileAction::Diff(args) => diff::run(&args.slow_qid, &args.fast_qid, env).await,
+        ProfileAction::History(args) => {
+            history::run(&args.sql_pattern, args.days, args.limit, env).await
+        }
+    }
+}
diff --git a/src/commands/profile/summary.rs b/src/commands/profile/summary.rs
new file mode 100644
index 0000000..b3d1f4b
--- /dev/null
+++ b/src/commands/profile/summary.rs
@@ -0,0 +1,530 @@
+use crate::config::Environment;
+use crate::connection::MysqlConnection;
+use crate::parser::profile_parser;
+use crate::parser::section_parser;
+use crate::parser::value_parser;
+use serde_json::{json, Value};
+
+/// Default profile output: summary + plan + top operators + fragment breakdown + scanned table DDLs.
+/// ONE call = everything the agent needs for slow query diagnosis.
+pub async fn run(
+    query_id: &str,
+    profile_text: Option<&str>,
+    env: &Environment,
+) -> anyhow::Result<Value> {
+    if let Some(text) = profile_text {
+        return run_full(text, env, None, None, Vec::new()).await;
+    }
+
+    // Track the fetch outcome so we can surface *why* when the fallback fires.
+    let fetch_failure = match super::fetch::fetch_profile_text(query_id, env).await {
+        Ok(fetched) => {
+            let attempts = fetched.attempts.clone();
+            return run_full(
+                &fetched.text,
+                env,
+                Some(fetched.served_by),
+                Some(fetched.via),
+                attempts,
+            )
+            .await;
+        }
+        Err(f) => f,
+    };
+
+    // Fallback: SQL summary (no profile text available anywhere).
+    if let Some(summary) = super::fetch::fetch_summary_from_sql(query_id, env).await? {
+        let total_time_str = summary
+            .get("total_time")
+            .and_then(|v| v.as_str())
+            .unwrap_or("");
+        let total_time_ms = value_parser::parse_duration_ms(total_time_str);
+
+        let note = build_fallback_note(&fetch_failure);
+
+        return Ok(json!({
+            "summary": {
+                "query_id": summary.get("query_id"),
+                "total_time": total_time_str,
+                "total_time_ms": total_time_ms,
+                "state": summary.get("state"),
+                "sql": summary.get("sql"),
+            },
+            "time_breakdown": null,
+            "operators": [],
+            "note": note,
+            "fetch_attempts": fetch_failure.attempts_json(),
+        }));
+    }
+
+    // Not even in SHOW QUERY PROFILE — bail with the full attempt log.
+    anyhow::bail!("{fetch_failure}")
+}
+
+/// Human-readable note for the fallback path.
+/// Picks the most specific hint we can infer from the attempts we saw.
+fn build_fallback_note(failure: &super::fetch::FetchFailure) -> String {
+    let attempts = &failure.attempts;
+
+    let any_unreachable = attempts
+        .iter()
+        .any(|a| a.result.starts_with("Connection failed"));
+    if any_unreachable {
+        return format!(
+            "HTTP endpoint unreachable on configured port. VeloDB Cloud uses \
+             --http-port 8080; self-hosted Doris uses 8030. Run `{} auth status` \
+             to verify, or re-add auth with the right port.",
+            failure.binary
+        );
+    }
+
+    let all_4xx_5xx = !attempts.is_empty()
+        && attempts.iter().all(|a| {
+            a.result.starts_with("HTTP error [4") || a.result.starts_with("HTTP error [5")
+        });
+    if all_4xx_5xx {
+        return "Profile not found. REST v2 with is_all_node=true already aggregates \
+                across FEs, so this usually means the profile was evicted (Doris keeps \
+                only a limited number per FE). Try immediately after the query runs, \
+                or raise max_query_profile_num on the FEs."
+            .to_string();
+    }
+
+    "Full profile text not accessible. See fetch_attempts for details, or pass \
+     --file <profile.txt> exported from the web UI."
+        .to_string()
+}
+
+/// Build the complete profile output with all context.
+async fn run_full(
+    text: &str,
+    env: &Environment,
+    served_by: Option<String>,
+    via: Option<&'static str>,
+    attempts: Vec<super::fetch::FetchAttempt>,
+) -> anyhow::Result<Value> {
+    let profile = profile_parser::parse(text);
+    let flat_ops = profile_parser::flatten_operators(&profile);
+
+    let top_ops: Vec<Value> = flat_ops
+        .iter()
+        .map(|op| serde_json::to_value(op).unwrap_or(Value::Null))
+        .collect();
+
+    // Physical plan
+    let normalized = section_parser::normalize_text(text);
+    let sections = section_parser::split_sections(&normalized);
+    let physical_plan = sections.get("Physical Plan").cloned();
+
+    // Session vars with impact classification
+    let session_vars: Vec<Value> = profile
+        .changed_session_vars
+        .iter()
+        .map(|var| {
+            json!({
+                "name": var.name,
+                "value": var.current_value,
+                "default": var.default_value,
+                "impact": classify_session_var_impact(&var.name),
+            })
+        })
+        .collect();
+
+    // Fragment-level breakdown: aggregate operator times per fragment
+    let fragments: Vec<Value> = profile
+        .fragments
+        .iter()
+        .map(|frag| {
+            let mut total_exec_ms: f64 = 0.0;
+            let mut total_shuffle_bytes: f64 = 0.0;
+            let mut instance_num: i32 = 0;
+
+            for pipeline in &frag.pipelines {
+                if pipeline.instance_num > instance_num {
+                    instance_num = pipeline.instance_num;
+                }
+                for op in &pipeline.operators {
+                    total_exec_ms += op
+                        .metrics
+                        .exec_time
+                        .as_ref()
+                        .and_then(|v| v.avg)
+                        .unwrap_or(0.0);
+
+                    // Accumulate shuffle bytes from exchange operators
+                    total_shuffle_bytes += op
+                        .all_counters
+                        .get("ShuffleSendBytes")
+                        .or_else(|| op.all_counters.get("BytesSent"))
+                        .and_then(|v| v.sum.or(v.avg))
+                        .unwrap_or(0.0);
+                }
+            }
+
+            let mut frag_json = json!({
+                "id": frag.id,
+                "exec_time_ms": round2(total_exec_ms),
+                "instances": instance_num,
+                "pipelines": frag.pipelines.len(),
+            });
+
+            if total_shuffle_bytes > 0.0 {
+                frag_json["shuffle_bytes"] = json!(total_shuffle_bytes as u64);
+            }
+
+            frag_json
+        })
+        .collect();
+
+    // Extract scanned table names from operators
+    let scanned_tables: Vec<String> = flat_ops
+        .iter()
+        .filter_map(|op| op.table.as_ref())
+        .map(|t| t.split('(').next().unwrap_or(t).trim().to_string())
+        .filter(|t| !t.is_empty())
+        .collect::<std::collections::BTreeSet<_>>()
+        .into_iter()
+        .collect();
+
+    // Auto-fetch DDL + health for each scanned table (the key merge)
+    let mut table_context: serde_json::Map<String, Value> = serde_json::Map::new();
+    if !scanned_tables.is_empty() {
+        if let Ok(mut conn) = MysqlConnection::connect(env).await {
+            // Try to USE the database from profile or from table names
+            let db_to_use = profile
+                .summary
+                .default_db
+                .as_deref()
+                .filter(|s| !s.is_empty())
+                .or_else(|| {
+                    scanned_tables
+                        .iter()
+                        .find(|t| t.contains('.'))
+                        .and_then(|t| t.split('.').next())
+                });
+            if let Some(db) = db_to_use {
+                let _ = conn.exec(&format!("USE `{db}`")).await;
+            }
+
+            for table in &scanned_tables {
+                let mut entry = json!({});
+
+                // Handle db.table format: try full name first, then just table name
+                let ddl_queries = if table.contains('.') {
+                    let parts: Vec<&str> = table.split('.').collect();
+                    vec![
+                        format!("SHOW CREATE TABLE `{}`.`{}`", parts[0], parts[1]),
+                        format!("SHOW CREATE TABLE `{}`", parts.last().unwrap_or(&"")),
+                    ]
+                } else {
+                    vec![format!("SHOW CREATE TABLE `{table}`")]
+                };
+
+                // DDL
+                for ddl_sql in &ddl_queries {
+                    if let Ok(ddl_result) = conn.query(ddl_sql).await {
+                        if let Some(ddl) = ddl_result
+                            .rows
+                            .first()
+                            .and_then(|r| r.get("Create Table"))
+                            .and_then(|v| v.as_str())
+                        {
+                            entry["ddl"] = Value::String(ddl.to_string());
+                            break;
+                        }
+                    }
+                }
+
+                // Tablet health from SHOW DATA SKEW
+                let tbl_name = table.split('.').last().unwrap_or(table);
+                if let Ok(skew_result) = conn
+                    .query(&format!("SHOW DATA SKEW FROM `{tbl_name}`"))
+                    .await
+                {
+                    let mut sizes: Vec<f64> = Vec::new();
+                    let mut total_rows: u64 = 0;
+                    for row in &skew_result.rows {
+                        let size = row
+                            .get("AvgDataSize")
+                            .and_then(|v| {
+                                v.as_u64()
+                                    .or_else(|| v.as_str().and_then(|s| s.parse().ok()))
+                            })
+                            .unwrap_or(0) as f64;
+                        sizes.push(size);
+                        total_rows += row
+                            .get("AvgRowCount")
+                            .and_then(|v| {
+                                v.as_u64()
+                                    .or_else(|| v.as_str().and_then(|s| s.parse().ok()))
+                            })
+                            .unwrap_or(0);
+                    }
+
+                    if !sizes.is_empty() {
+                        let avg = sizes.iter().sum::<f64>() / sizes.len() as f64;
+                        let max = sizes.iter().cloned().fold(f64::NEG_INFINITY, f64::max);
+                        let skew = if avg > 0.0 { max / avg } else { 1.0 };
+                        let total_bytes: f64 = sizes.iter().sum();
+
+                        entry["total_rows"] = json!(total_rows);
+                        entry["total_size_gb"] =
+                            json!(round2(total_bytes / (1024.0 * 1024.0 * 1024.0)));
+                        entry["tablets"] = json!(sizes.len());
+                        entry["tablet_skew"] = json!(round1(skew));
+                    }
+                }
+
+                table_context.insert(table.clone(), entry);
+            }
+        }
+    }
+
+    // Query-level aggregate stats (the "is this bad?" signal)
+    let total_scan_rows: f64 = flat_ops
+        .iter()
+        .filter(|op| op.name.contains("SCAN"))
+        .filter_map(|op| op.output_rows)
+        .sum();
+    let total_shuffle_bytes: f64 = flat_ops.iter().filter_map(|op| op.shuffle_bytes).sum();
+    let total_peak_mem: f64 = flat_ops.iter().filter_map(|op| op.peak_mem_bytes).sum();
+    let spilled_count = flat_ops
+        .iter()
+        .filter(|op| op.spilled == Some(true))
+        .count();
+    let blocked_count = flat_ops
+        .iter()
+        .filter(|op| op.blocked_on_upstream == Some(true))
+        .count();
+
+    let mut result = json!({
+        "summary": {
+            "query_id": profile.summary.query_id,
+            "total_time": profile.summary.total_time,
+            "total_time_ms": profile.summary.total_time_ms,
+            "state": profile.summary.state,
+            "sql": profile.summary.sql,
+            "doris_version": profile.summary.doris_version,
+            "is_nereids": profile.summary.is_nereids,
+            "instances": profile.summary.total_instances,
+            "workload_group": profile.execution_summary.workload_group,
+        },
+        "time_breakdown": {
+            "parse_sql": profile.execution_summary.parse_sql_time,
+            "plan": profile.execution_summary.plan_time,
+            "schedule": profile.execution_summary.schedule_time,
+            "wait_fetch_result": profile.execution_summary.wait_fetch_result_time,
+            "fetch_result": profile.execution_summary.fetch_result_time,
+            "nereids_analysis": profile.execution_summary.nereids_analysis_time,
+            "nereids_rewrite": profile.execution_summary.nereids_rewrite_time,
+            "nereids_optimize": profile.execution_summary.nereids_optimize_time,
+        },
+        "query_stats": {
+            "total_scan_rows": if total_scan_rows > 0.0 { json!(total_scan_rows as u64) } else { json!(null) },
+            "total_shuffle_bytes": if total_shuffle_bytes > 0.0 { json!(total_shuffle_bytes as u64) } else { json!(null) },
+            "total_peak_memory_bytes": if total_peak_mem > 0.0 { json!(total_peak_mem as u64) } else { json!(null) },
+            "spilled_operators": spilled_count,
+            "blocked_operators": blocked_count,
+            "operator_count": flat_ops.len(),
+            "fragment_count": profile.fragments.len(),
+        },
+        "fragments": fragments,
+        "operators": top_ops,
+    });
+
+    if let Some(plan) = physical_plan {
+        result["physical_plan"] = Value::String(plan);
+    }
+    if !session_vars.is_empty() {
+        result["changed_session_vars"] = Value::Array(session_vars);
+    }
+    if !table_context.is_empty() {
+        result["scanned_tables"] = Value::Object(table_context);
+    }
+
+    // Provenance for multi-FE clusters: tell the caller which FE served this
+    // and, if we had to fall back, what we tried.
+    if let Some(sb) = served_by {
+        result["served_by"] = Value::String(sb);
+    }
+    if let Some(v) = via {
+        result["fetch_via"] = Value::String(v.to_string());
+    }
+    if !attempts.is_empty() {
+        let attempts_json: Vec<Value> = attempts.iter().map(|a| a.to_json()).collect();
+        result["fetch_attempts"] = Value::Array(attempts_json);
+    }
+
+    Ok(result)
+}
+
+/// Public accessor for session variable impact classification.
+pub fn classify_var_impact(name: &str) -> &'static str {
+    classify_session_var_impact(name)
+}
+
+/// Classify session variable by performance impact category.
+/// Based on actual Doris SessionVariable.java source code categories.
+fn classify_session_var_impact(name: &str) -> &'static str {
+    // Exact matches first (from Doris SessionVariable.java)
+    match name {
+        // Memory: exec limits, spill thresholds, buffer sizes
+        "exec_mem_limit"
+        | "scan_queue_mem_limit"
+        | "local_exchange_free_blocks_limit"
+        | "spill_min_revocable_mem"
+        | "spill_sort_mem_limit"
+        | "spill_streaming_agg_mem_limit"
+        | "full_sort_max_buffered_bytes"
+        | "minimum_operator_memory_required_kb"
+        | "exchange_multi_blocks_byte_size"
+        | "enable_spill"
+        | "enable_force_spill"
+        | "spill_sort_batch_bytes"
+        | "spill_aggregation_partition_count"
+        | "spill_hash_join_partition_count"
+        | "spill_revocable_memory_high_watermark_percent"
+        | "enable_reserve_memory"
+        | "low_memory_mode_buffer_limit"
+        | "data_queue_max_blocks" => "memory",
+
+        // Parallelism: instance counts, scanner concurrency, pipeline tasks
+        "parallel_fragment_exec_instance_num"
+        | "parallel_pipeline_task_num"
+        | "max_scanners_concurrency"
+        | "max_file_scanners_concurrency"
+        | "min_scanners_concurrency"
+        | "min_file_scanners_concurrency"
+        | "min_scan_scheduler_concurrency"
+        | "colocate_max_parallel_num"
+        | "parallel_exchange_instance_num"
+        | "parallel_scan_max_scanners_count"
+        | "parallel_scan_min_rows_per_scanner"
+        | "max_instance_num"
+        | "max_column_reader_num"
+        | "send_batch_parallelism"
+        | "query_slot_count" => "parallelism",
+
+        // Runtime filter: filter types, sizes, wait times
+        "runtime_filter_mode"
+        | "runtime_filter_type"
+        | "runtime_filter_wait_time_ms"
+        | "runtime_filter_wait_infinitely"
+        | "runtime_filters_max_num"
+        | "runtime_filter_max_in_num"
+        | "runtime_bloom_filter_size"
+        | "runtime_bloom_filter_min_size"
+        | "runtime_bloom_filter_max_size"
+        | "enable_runtime_filter_prune"
+        | "enable_sync_runtime_filter_size"
+        | "expand_runtime_filter_by_inner_join" => "filter",
+
+        // Join/aggregation: join methods, reorder, broadcast thresholds
+        "broadcast_row_count_limit"
+        | "broadcast_hashtable_mem_limit_percentage"
+        | "auto_broadcast_join_threshold"
+        | "disable_colocate_plan"
+        | "enable_bucket_shuffle_join"
+        | "prefer_join_method"
+        | "disable_join_reorder"
+        | "enable_cost_based_join_reorder"
+        | "max_join_number_of_reorder"
+        | "enable_bushy_tree"
+        | "disable_streaming_preaggregations"
+        | "enable_distinct_streaming_aggregation"
+        | "batch_size"
+        | "enable_push_down_no_group_agg" => "optimization",
+
+        // Scan/IO: scan modes, pushdown, file format options
+        "enable_parallel_scan"
+        | "enable_shared_scan"
+        | "enable_local_shuffle"
+        | "force_to_local_shuffle"
+        | "enable_local_merge_sort"
+        | "enable_orc_lazy_materialization"
+        | "enable_parquet_lazy_materialization"
+        | "enable_parquet_filter_by_bloom_filter"
+        | "enable_parquet_filter_by_min_max"
+        | "file_split_size"
+        | "max_initial_file_split_size"
+        | "max_scan_key_num"
+        | "max_pushdown_conditions_per_column"
+        | "enable_common_expr_pushdown"
+        | "enable_count_on_index_pushdown"
+        | "partition_pruning_expand_threshold"
+        | "enable_projection" => "io",
+
+        // Cache: SQL cache, file cache, query cache, page cache
+        "enable_sql_cache"
+        | "enable_query_cache"
+        | "query_cache_force_refresh"
+        | "query_cache_entry_max_bytes"
+        | "query_cache_entry_max_rows"
+        | "enable_file_cache"
+        | "disable_file_cache"
+        | "file_cache_query_limit_percent"
+        | "enable_page_cache"
+        | "enable_segment_cache"
+        | "enable_inverted_index_query_cache"
+        | "enable_inverted_index_searcher_cache" => "cache",
+
+        // Timeout: query, insert, connection timeouts
+        "query_timeout"
+        | "insert_timeout"
+        | "analyze_timeout"
+        | "max_execution_time"
+        | "insert_visible_timeout_ms"
+        | "interactive_timeout"
+        | "wait_timeout"
+        | "net_write_timeout"
+        | "net_read_timeout" => "timeout",
+
+        // Optimization: planner settings, predicate handling
+        "enable_nereids_planner"
+        | "enable_partition_topn"
+        | "enable_infer_predicate"
+        | "enable_short_circuit_query"
+        | "enable_fold_constant_by_be"
+        | "skip_prune_predicate"
+        | "topn_opt_limit_threshold"
+        | "enable_two_phase_read_opt"
+        | "enable_stats"
+        | "experimental_enable_agg_state" => "optimization",
+
+        // Fallback: pattern-based for variables not in the exact list
+        _ => classify_by_pattern(name),
+    }
+}
+
+fn classify_by_pattern(name: &str) -> &'static str {
+    let n = name.to_lowercase();
+    if n.contains("mem") || n.contains("spill") || n.contains("buffer") {
+        "memory"
+    } else if n.contains("parallel") || n.contains("instance") || n.contains("thread") {
+        "parallelism"
+    } else if n.contains("runtime_filter") || n.contains("bloom_filter") {
+        "filter"
+    } else if n.contains("cache") {
+        "cache"
+    } else if n.contains("timeout") {
+        "timeout"
+    } else if n.contains("scan") || n.contains("pushdown") {
+        "io"
+    } else if n.contains("join")
+        || n.contains("reorder")
+        || n.contains("nereids")
+        || n.contains("optimize")
+    {
+        "optimization"
+    } else {
+        "other"
+    }
+}
+
+fn round1(v: f64) -> f64 {
+    (v * 10.0).round() / 10.0
+}
+
+fn round2(v: f64) -> f64 {
+    (v * 100.0).round() / 100.0
+}
diff --git a/src/commands/sql.rs b/src/commands/sql.rs
new file mode 100644
index 0000000..d22417d
--- /dev/null
+++ b/src/commands/sql.rs
@@ -0,0 +1,45 @@
+use crate::cli::sql::SqlArgs;
+use crate::config::Environment;
+use crate::connection::MysqlConnection;
+use serde_json::{json, Value};
+
+pub async fn run(args: SqlArgs, env: &Environment) -> anyhow::Result<Value> {
+    let sql = if let Some(query) = &args.query {
+        query.clone()
+    } else if let Some(file) = &args.file {
+        std::fs::read_to_string(file)
+            .map_err(|e| anyhow::anyhow!("Failed to read SQL file '{file}': {e}"))?
+    } else {
+        anyhow::bail!("Provide a SQL query or use -f <file.sql>");
+    };
+
+    // `env` carries any post-connect directive from `--init-sql` / DORIS_INIT_SQL
+    // (e.g. the `USE @<compute-group>` handed off by `cloudcli cloud endpoint`);
+    // MysqlConnection::connect applies it automatically.
+    let mut conn = MysqlConnection::connect(env).await?;
+
+    // Apply session variables
+    if args.profile {
+        conn.exec("SET enable_profile=true").await?;
+    }
+    if args.no_cache {
+        conn.exec("SET enable_sql_cache=false").await?;
+    }
+    for var in &args.set_vars {
+        conn.exec(&format!("SET {var}")).await?;
+    }
+
+    let start = std::time::Instant::now();
+    let result = conn.query(&sql).await?;
+    let exec_time_ms = start.elapsed().as_millis() as u64;
+
+    let query_id = conn.last_query_id().await.unwrap_or_default();
+
+    Ok(json!({
+        "query_id": query_id,
+        "exec_time_ms": exec_time_ms,
+        "rows_returned": result.rows.len(),
+        "columns": result.columns,
+        "rows": result.rows,
+    }))
+}
diff --git a/src/commands/tablet/detail.rs b/src/commands/tablet/detail.rs
new file mode 100644
index 0000000..9a686ee
--- /dev/null
+++ b/src/commands/tablet/detail.rs
@@ -0,0 +1,170 @@
+use super::overview::parse_table_name;
+use crate::config::Environment;
+use crate::connection::MysqlConnection;
+use serde_json::{json, Value};
+use std::collections::BTreeMap;
+
+/// --detail: distribution + per-tablet + backend mapping in ONE call.
+pub async fn run(
+    table: &str,
+    partition_filter: Option<&str>,
+    env: &Environment,
+) -> anyhow::Result<Value> {
+    let (db, tbl) = parse_table_name(table);
+    let mut conn = MysqlConnection::connect(env).await?;
+
+    if let Some(db) = &db {
+        conn.exec(&format!("USE `{db}`")).await?;
+    }
+
+    // Get all tablets (optionally filtered by partition)
+    let tablet_sql = if let Some(part) = partition_filter {
+        format!("SHOW TABLETS FROM `{tbl}` PARTITION(`{part}`)")
+    } else {
+        format!("SHOW TABLETS FROM `{tbl}`")
+    };
+    let tablet_result = conn.query(&tablet_sql).await?;
+
+    // Get partitions for context
+    let part_result = conn.query(&format!("SHOW PARTITIONS FROM `{tbl}`")).await?;
+
+    // Build partition name lookup: PartitionId → PartitionName
+    let mut partition_names: BTreeMap<String, String> = BTreeMap::new();
+    let mut partition_buckets: BTreeMap<String, u64> = BTreeMap::new();
+    for row in &part_result.rows {
+        let pid = row
+            .get("PartitionId")
+            .and_then(|v| v.as_str().or_else(|| v.as_u64().map(|_| "")).or(Some("")))
+            .unwrap_or("")
+            .to_string();
+        let pname = row
+            .get("PartitionName")
+            .and_then(|v| v.as_str())
+            .unwrap_or("")
+            .to_string();
+        let buckets = row
+            .get("Buckets")
+            .and_then(|v| {
+                v.as_u64()
+                    .or_else(|| v.as_str().and_then(|s| s.parse().ok()))
+            })
+            .unwrap_or(0);
+        partition_names.insert(pid, pname.clone());
+        partition_buckets.insert(pname, buckets);
+    }
+
+    // Build per-tablet data and aggregate by partition + backend
+    let mut tablets = Vec::new();
+    let mut partition_stats: BTreeMap<String, Vec<f64>> = BTreeMap::new();
+    let mut backend_stats: BTreeMap<u64, (u64, f64)> = BTreeMap::new(); // backend_id → (count, total_mb)
+
+    // Determine partition name: try matching from SHOW PARTITIONS, else use filter or "default"
+    let default_partition = partition_filter
+        .map(|s| s.to_string())
+        .or_else(|| {
+            part_result.rows.first().and_then(|r| {
+                r.get("PartitionName")
+                    .and_then(|v| v.as_str())
+                    .map(|s| s.to_string())
+            })
+        })
+        .unwrap_or_else(|| tbl.to_string());
+
+    for row in &tablet_result.rows {
+        let tablet_id = row.get("TabletId").and_then(|v| v.as_u64()).unwrap_or(0);
+        let backend_id = row.get("BackendId").and_then(|v| v.as_u64()).unwrap_or(0);
+        let size_bytes = row
+            .get("LocalDataSize")
+            .and_then(|v| {
+                v.as_u64()
+                    .or_else(|| v.as_str().and_then(|s| s.parse().ok()))
+            })
+            .unwrap_or(0);
+        let size_mb = size_bytes as f64 / (1024.0 * 1024.0);
+        let row_count = row
+            .get("RowCount")
+            .and_then(|v| {
+                v.as_u64()
+                    .or_else(|| v.as_str().and_then(|s| s.parse().ok()))
+            })
+            .unwrap_or(0);
+        let version = row
+            .get("Version")
+            .and_then(|v| {
+                v.as_u64()
+                    .or_else(|| v.as_str().and_then(|s| s.parse().ok()))
+            })
+            .unwrap_or(0);
+        let state = row
+            .get("State")
+            .and_then(|v| v.as_str())
+            .unwrap_or("UNKNOWN");
+
+        // For single-partition tables, use the default partition name
+        let partition = default_partition.clone();
+
+        partition_stats
+            .entry(partition.clone())
+            .or_default()
+            .push(size_mb);
+
+        let entry = backend_stats.entry(backend_id).or_insert((0, 0.0));
+        entry.0 += 1;
+        entry.1 += size_mb;
+
+        tablets.push(json!({
+            "tablet_id": tablet_id,
+            "partition": partition,
+            "backend_id": backend_id,
+            "size_mb": round1(size_mb),
+            "row_count": row_count,
+            "version": version,
+            "state": state,
+        }));
+    }
+
+    // Aggregate partition stats
+    let partitions: Vec<Value> = partition_stats
+        .iter()
+        .map(|(name, sizes)| {
+            let count = sizes.len() as f64;
+            let sum: f64 = sizes.iter().sum();
+            let avg = sum / count;
+            let min = sizes.iter().cloned().fold(f64::INFINITY, f64::min);
+            let max = sizes.iter().cloned().fold(f64::NEG_INFINITY, f64::max);
+            let skew = if avg > 0.0 { max / avg } else { 1.0 };
+
+            json!({
+                "name": name,
+                "tablets": sizes.len(),
+                "total_mb": round1(sum),
+                "avg_mb": round1(avg),
+                "min_mb": round1(min),
+                "max_mb": round1(max),
+                "skew_ratio": round1(skew),
+            })
+        })
+        .collect();
+
+    // Backend distribution
+    let backends: Vec<Value> = backend_stats
+        .iter()
+        .map(|(id, (count, total_mb))| {
+            json!({
+                "backend_id": id,
+                "tablet_count": count,
+                "total_mb": round1(*total_mb),
+            })
+        })
+        .collect();
+
+    Ok(json!({
+        "partitions": partitions,
+        "tablets": tablets,
+        "backends": backends,
+    }))
+}
+
+fn round1(v: f64) -> f64 {
+    (v * 10.0).round() / 10.0
+}
diff --git a/src/commands/tablet/mod.rs b/src/commands/tablet/mod.rs
new file mode 100644
index 0000000..4c4df50
--- /dev/null
+++ b/src/commands/tablet/mod.rs
@@ -0,0 +1,14 @@
+pub mod detail;
+pub mod overview;
+
+use crate::cli::tablet::TabletArgs;
+use crate::config::Environment;
+use serde_json::Value;
+
+pub async fn run(args: TabletArgs, env: &Environment) -> anyhow::Result<Value> {
+    if args.detail {
+        detail::run(&args.table, args.partition.as_deref(), env).await
+    } else {
+        overview::run(&args.table, env).await
+    }
+}
diff --git a/src/commands/tablet/overview.rs b/src/commands/tablet/overview.rs
new file mode 100644
index 0000000..c128e86
--- /dev/null
+++ b/src/commands/tablet/overview.rs
@@ -0,0 +1,288 @@
+use crate::config::Environment;
+use crate::connection::MysqlConnection;
+use once_cell::sync::Lazy;
+use regex::Regex;
+use serde_json::{json, Value};
+
+static MODEL_RE: Lazy<Regex> =
+    Lazy::new(|| Regex::new(r"(?i)(DUPLICATE|UNIQUE|AGGREGATE)\s+KEY").unwrap());
+static DIST_RE: Lazy<Regex> = Lazy::new(|| {
+    Regex::new(r"(?i)DISTRIBUTED\s+BY\s+(HASH|RANDOM)\s*\(([^)]*)\)\s*BUCKETS\s*(\d+)").unwrap()
+});
+static AUTO_BUCKET_RE: Lazy<Regex> = Lazy::new(|| {
+    Regex::new(r"(?i)DISTRIBUTED\s+BY\s+(HASH|RANDOM)\s*\(([^)]*)\)\s*BUCKETS\s*AUTO").unwrap()
+});
+static KEY_RE: Lazy<Regex> =
+    Lazy::new(|| Regex::new(r"(?i)(DUPLICATE|UNIQUE|AGGREGATE)\s+KEY\s*\(([^)]+)\)").unwrap());
+static REPL_RE: Lazy<Regex> =
+    Lazy::new(|| Regex::new(r#""replication_num"\s*=\s*"(\d+)""#).unwrap());
+
+/// Default: overview + keys (SHOW COLUMN STATS) + health (SHOW DATA SKEW) in ONE call.
+pub async fn run(table: &str, env: &Environment) -> anyhow::Result<Value> {
+    let (db, tbl) = parse_table_name(table);
+    let mut conn = MysqlConnection::connect(env).await?;
+
+    if let Some(db) = &db {
+        conn.exec(&format!("USE `{db}`")).await?;
+    }
+
+    // ── 1. DDL parsing ──
+    let ddl_result = conn.query(&format!("SHOW CREATE TABLE `{tbl}`")).await?;
+    let ddl = ddl_result
+        .rows
+        .first()
+        .and_then(|r| r.get("Create Table"))
+        .and_then(|v| v.as_str())
+        .unwrap_or("")
+        .to_string();
+
+    let model = MODEL_RE
+        .captures(&ddl)
+        .map(|c| c[1].to_uppercase())
+        .unwrap_or_else(|| "UNKNOWN".to_string());
+
+    let sort_key: Vec<String> = KEY_RE
+        .captures(&ddl)
+        .map(|c| {
+            c[2].split(',')
+                .map(|k| k.trim().trim_matches('`').to_string())
+                .collect()
+        })
+        .unwrap_or_default();
+
+    let (bucket_type, bucket_key, bucket_count) = if let Some(caps) = DIST_RE.captures(&ddl) {
+        let btype = caps[1].to_uppercase();
+        let keys: Vec<String> = caps[2]
+            .split(',')
+            .map(|k| k.trim().trim_matches('`').to_string())
+            .collect();
+        let count: u32 = caps[3].parse().unwrap_or(0);
+        (btype, keys, count)
+    } else if let Some(caps) = AUTO_BUCKET_RE.captures(&ddl) {
+        let btype = caps[1].to_uppercase();
+        let keys: Vec<String> = caps[2]
+            .split(',')
+            .map(|k| k.trim().trim_matches('`').to_string())
+            .collect();
+        (btype, keys, 0u32)
+    } else {
+        ("UNKNOWN".to_string(), vec![], 0u32)
+    };
+
+    let replication_num: u32 = REPL_RE
+        .captures(&ddl)
+        .and_then(|c| c[1].parse().ok())
+        .unwrap_or(1);
+
+    // ── 2. Partition summary ──
+    let part_result = conn.query(&format!("SHOW PARTITIONS FROM `{tbl}`")).await?;
+
+    let mut total_size_bytes: f64 = 0.0;
+    let mut total_rows: u64 = 0;
+    let mut partition_count: u32 = 0;
+    let mut empty_partitions: u32 = 0;
+    let mut max_part_name = String::new();
+    let mut max_part_size: f64 = 0.0;
+    let mut min_part_name = String::new();
+    let mut min_part_size: f64 = f64::MAX;
+    let mut actual_bucket_count = bucket_count;
+
+    for row in &part_result.rows {
+        partition_count += 1;
+        let data_size = row.get("DataSize").and_then(|v| v.as_str()).unwrap_or("0");
+        let size_bytes = parse_size_string(data_size);
+        let row_count = row
+            .get("RowCount")
+            .and_then(|v| {
+                v.as_u64()
+                    .or_else(|| v.as_str().and_then(|s| s.parse().ok()))
+            })
+            .unwrap_or(0);
+
+        if partition_count == 1 {
+            if let Some(buckets) = row.get("Buckets").and_then(|v| {
+                v.as_u64()
+                    .or_else(|| v.as_str().and_then(|s| s.parse().ok()))
+            }) {
+                actual_bucket_count = buckets as u32;
+            }
+        }
+
+        total_size_bytes += size_bytes;
+        total_rows += row_count;
+
+        if row_count == 0 && size_bytes < 1.0 {
+            empty_partitions += 1;
+        }
+
+        let pname = row
+            .get("PartitionName")
+            .and_then(|v| v.as_str())
+            .unwrap_or("");
+
+        if size_bytes > max_part_size {
+            max_part_size = size_bytes;
+            max_part_name = pname.to_string();
+        }
+        if size_bytes < min_part_size {
+            min_part_size = size_bytes;
+            min_part_name = pname.to_string();
+        }
+    }
+
+    if partition_count == 0 {
+        min_part_size = 0.0;
+    }
+
+    // ── 3. Column stats (SHOW COLUMN STATS — fast, no scan) ──
+    let columns = get_column_stats(&mut conn, &tbl).await;
+
+    // ── 4. Health from SHOW DATA SKEW ──
+    let health = get_health_summary(&mut conn, &tbl).await;
+
+    let full_table = if let Some(db) = &db {
+        format!("{db}.{tbl}")
+    } else {
+        tbl.to_string()
+    };
+
+    Ok(json!({
+        "table": full_table,
+        "model": model,
+        "bucket_type": bucket_type,
+        "bucket_key": bucket_key,
+        "bucket_count": actual_bucket_count,
+        "replication_num": replication_num,
+        "sort_key": sort_key,
+        "total_size_gb": round2(total_size_bytes / (1024.0 * 1024.0 * 1024.0)),
+        "total_rows": total_rows,
+        "partitions": partition_count,
+        "empty_partitions": empty_partitions,
+        "max_partition": {"name": max_part_name, "size_gb": round2(max_part_size / (1024.0 * 1024.0 * 1024.0))},
+        "min_partition": {"name": min_part_name, "size_gb": round2(min_part_size / (1024.0 * 1024.0 * 1024.0))},
+        "columns": columns,
+        "health": health,
+    }))
+}
+
+/// Get column stats from SHOW COLUMN STATS (fast path).
+async fn get_column_stats(conn: &mut MysqlConnection, tbl: &str) -> Vec<Value> {
+    let result = match conn.query(&format!("SHOW COLUMN STATS `{tbl}`")).await {
+        Ok(r) if !r.rows.is_empty() => r,
+        _ => return vec![],
+    };
+
+    result
+        .rows
+        .iter()
+        .map(|row| {
+            let ndv = row
+                .get("ndv")
+                .and_then(|v| {
+                    v.as_f64()
+                        .or_else(|| v.as_str().and_then(|s| s.parse().ok()))
+                })
+                .unwrap_or(0.0);
+            let count = row
+                .get("count")
+                .and_then(|v| {
+                    v.as_f64()
+                        .or_else(|| v.as_str().and_then(|s| s.parse().ok()))
+                })
+                .unwrap_or(1.0)
+                .max(1.0);
+            let null_count = row
+                .get("num_null")
+                .and_then(|v| {
+                    v.as_f64()
+                        .or_else(|| v.as_str().and_then(|s| s.parse().ok()))
+                })
+                .unwrap_or(0.0);
+
+            json!({
+                "name": row.get("column_name").and_then(|v| v.as_str()).unwrap_or(""),
+                "ndv": ndv as u64,
+                "null_pct": round1((null_count / count) * 100.0),
+                "min": row.get("min").and_then(|v| v.as_str()),
+                "max": row.get("max").and_then(|v| v.as_str()),
+            })
+        })
+        .collect()
+}
+
+/// Get health summary from SHOW DATA SKEW.
+async fn get_health_summary(conn: &mut MysqlConnection, tbl: &str) -> Value {
+    let result = match conn.query(&format!("SHOW DATA SKEW FROM `{tbl}`")).await {
+        Ok(r) if !r.rows.is_empty() => r,
+        _ => return json!(null),
+    };
+
+    let mut sizes: Vec<f64> = Vec::new();
+    for row in &result.rows {
+        let size = row
+            .get("AvgDataSize")
+            .and_then(|v| {
+                v.as_u64()
+                    .or_else(|| v.as_str().and_then(|s| s.parse().ok()))
+            })
+            .unwrap_or(0) as f64;
+        sizes.push(size / (1024.0 * 1024.0));
+    }
+
+    if sizes.is_empty() {
+        return json!(null);
+    }
+
+    let count = sizes.len() as f64;
+    let avg = sizes.iter().sum::<f64>() / count;
+    let max = sizes.iter().cloned().fold(f64::NEG_INFINITY, f64::max);
+    let min = sizes.iter().cloned().fold(f64::INFINITY, f64::min);
+    let skew = if avg > 0.0 { max / avg } else { 1.0 };
+
+    json!({
+        "tablets": sizes.len(),
+        "avg_tablet_mb": round1(avg),
+        "min_tablet_mb": round1(min),
+        "max_tablet_mb": round1(max),
+        "tablet_skew": round1(skew),
+    })
+}
+
+/// Parse a Doris size string like "49.618 MB" to bytes.
+pub fn parse_size_string(s: &str) -> f64 {
+    let s = s.trim();
+    if s.is_empty() || s == "0" || s == "0.00" {
+        return 0.0;
+    }
+    static SIZE_RE: Lazy<Regex> = Lazy::new(|| Regex::new(r"([\d.]+)\s*(TB|GB|MB|KB|B)?").unwrap());
+    if let Some(caps) = SIZE_RE.captures(s) {
+        let num: f64 = caps[1].parse().unwrap_or(0.0);
+        let unit = caps.get(2).map(|m| m.as_str()).unwrap_or("B");
+        match unit {
+            "TB" => num * 1024.0 * 1024.0 * 1024.0 * 1024.0,
+            "GB" => num * 1024.0 * 1024.0 * 1024.0,
+            "MB" => num * 1024.0 * 1024.0,
+            "KB" => num * 1024.0,
+            _ => num,
+        }
+    } else {
+        0.0
+    }
+}
+
+/// Parse "db.table" or just "table".
+pub fn parse_table_name(table: &str) -> (Option<String>, String) {
+    if let Some(dot) = table.find('.') {
+        (Some(table[..dot].to_string()), table[dot + 1..].to_string())
+    } else {
+        (None, table.to_string())
+    }
+}
+
+fn round1(v: f64) -> f64 {
+    (v * 10.0).round() / 10.0
+}
+
+fn round2(v: f64) -> f64 {
+    (v * 100.0).round() / 100.0
+}
diff --git a/src/commands/use_env.rs b/src/commands/use_env.rs
new file mode 100644
index 0000000..c1ebb18
--- /dev/null
+++ b/src/commands/use_env.rs
@@ -0,0 +1,67 @@
+use crate::cli::root::UseArgs;
+use crate::config::Store;
+use serde_json::{json, Value};
+
+pub fn run(args: UseArgs, store: &mut Store) -> anyhow::Result<Value> {
+    match args.name {
+        Some(name) => switch(store, &name),
+        None => show_current(store),
+    }
+}
+
+fn switch(store: &mut Store, name: &str) -> anyhow::Result<Value> {
+    // Extract config details before mutating store
+    let details = store
+        .list_envs()
+        .iter()
+        .find(|(n, _, _)| n == name)
+        .map(|(_, config, _)| (config.host.clone(), config.user.clone()));
+
+    store.set_default(name)?;
+
+    let mut result = json!({
+        "status": "switched",
+        "environment": name,
+    });
+
+    if let Some((host, user)) = details {
+        result["host"] = json!(host);
+        result["user"] = json!(user);
+        result["message"] = json!(format!("Switched to: {} ({} as {})", name, host, user));
+    }
+
+    Ok(result)
+}
+
+fn show_current(store: &Store) -> anyhow::Result<Value> {
+    let envs = store.list_envs();
+    let current = store.effective_env_name("default");
+
+    let list: Vec<Value> = envs
+        .iter()
+        .map(|(name, config, _)| {
+            json!({
+                "name": name,
+                "host": config.host,
+                "user": config.user,
+                "active": name == &current,
+            })
+        })
+        .collect();
+
+    if list.is_empty() {
+        Ok(json!({
+            "current": null,
+            "environments": [],
+            "message": format!(
+                "No environments configured. Run `{} auth add <name> --host <host> --user <user> --password <pass>` to get started.",
+                store.product.binary
+            )
+        }))
+    } else {
+        Ok(json!({
+            "current": current,
+            "environments": list,
+        }))
+    }
+}
diff --git a/src/config/environment.rs b/src/config/environment.rs
new file mode 100644
index 0000000..29d3b28
--- /dev/null
+++ b/src/config/environment.rs
@@ -0,0 +1,159 @@
+use crate::error::{VeloError, VeloResult};
+use crate::product::ProductProfile;
+use serde::{Deserialize, Serialize};
+
+/// A resolved environment with all connection details ready to use.
+#[derive(Debug, Clone)]
+pub struct Environment {
+    pub product: &'static ProductProfile,
+    /// The resolved environment's name (kept as metadata; not all paths read it).
+    #[allow(dead_code)]
+    pub name: String,
+    pub host: String,
+    pub mysql_port: u16,
+    pub http_port: u16,
+    pub user: String,
+    pub password: String,
+    pub socks5: Option<Socks5Config>,
+    /// Runtime-only (never persisted): a SQL statement to issue immediately
+    /// after `MysqlConnection::connect` succeeds — e.g. `USE @<compute-group>`
+    /// sourced from `--init-sql` / `DORIS_INIT_SQL` (the `cloudcli cloud
+    /// endpoint` handoff).
+    pub cluster_routing_directive: Option<String>,
+}
+
+/// Stored environment config (without secrets).
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct EnvironmentConfig {
+    pub host: String,
+    #[serde(default = "default_mysql_port")]
+    pub mysql_port: u16,
+    #[serde(default = "default_http_port")]
+    pub http_port: u16,
+    pub user: String,
+}
+
+/// Stored credentials (secrets).
+#[derive(Debug, Clone, Serialize, Deserialize, Default)]
+pub struct EnvironmentCredentials {
+    #[serde(default)]
+    pub password: String,
+}
+
+/// Runtime-only SOCKS5 proxy configuration.
+///
+/// Never persisted to disk. Sourced from the `--socks5` flag or `<PREFIX>_SOCKS5_*`
+/// env vars because BYOC bastions are multi-tenant — one tenant's credentials
+/// must not leak to another through a shared config file.
+#[derive(Debug, Clone)]
+pub struct Socks5Config {
+    pub host: String,
+    pub port: u16,
+    pub user: String,
+    pub pass: String,
+}
+
+impl Socks5Config {
+    /// Build from env vars. Returns None unless both host and port are set.
+    /// user/pass default to "admin"/"admin" per VeloDB BYOC convention.
+    pub fn from_env(product: &ProductProfile) -> Option<Self> {
+        let host = std::env::var(product.env_key("SOCKS5_HOST")).ok()?;
+        let port: u16 = std::env::var(product.env_key("SOCKS5_PORT"))
+            .ok()?
+            .parse()
+            .ok()?;
+        let user =
+            std::env::var(product.env_key("SOCKS5_USER")).unwrap_or_else(|_| "admin".to_string());
+        let pass =
+            std::env::var(product.env_key("SOCKS5_PASS")).unwrap_or_else(|_| "admin".to_string());
+        Some(Socks5Config {
+            host,
+            port,
+            user,
+            pass,
+        })
+    }
+
+    /// Parse `user:pass@host:port` (matches the Go mysql-client reference).
+    pub fn parse_flag(s: &str) -> VeloResult<Self> {
+        let (auth, hostport) = s.split_once('@').ok_or_else(|| {
+            VeloError::config(format!(
+                "--socks5 must be in 'user:pass@host:port' form, got '{s}'"
+            ))
+        })?;
+        let (user, pass) = auth.split_once(':').ok_or_else(|| {
+            VeloError::config(format!("--socks5 auth must be 'user:pass', got '{auth}'"))
+        })?;
+        let (host, port_s) = hostport.rsplit_once(':').ok_or_else(|| {
+            VeloError::config(format!(
+                "--socks5 host must be 'host:port', got '{hostport}'"
+            ))
+        })?;
+        let port: u16 = port_s.parse().map_err(|_| {
+            VeloError::config(format!("--socks5 port '{port_s}' is not a valid u16"))
+        })?;
+        Ok(Socks5Config {
+            host: host.to_string(),
+            port,
+            user: user.to_string(),
+            pass: pass.to_string(),
+        })
+    }
+}
+
+fn default_mysql_port() -> u16 {
+    9030
+}
+
+fn default_http_port() -> u16 {
+    8030
+}
+
+impl Environment {
+    /// Apply environment variable overrides (highest precedence before the --socks5 flag).
+    pub fn with_env_overrides(mut self) -> Self {
+        if let Ok(host) = std::env::var(self.product.env_key("HOST")) {
+            self.host = host;
+        }
+        if let Ok(user) = std::env::var(self.product.env_key("USER")) {
+            self.user = user;
+        }
+        if let Ok(password) = std::env::var(self.product.env_key("PASSWORD")) {
+            self.password = password;
+        }
+        if let Ok(port) = std::env::var(self.product.env_key("PORT")) {
+            if let Ok(p) = port.parse() {
+                self.mysql_port = p;
+            }
+        }
+        if let Ok(port) = std::env::var(self.product.env_key("HTTP_PORT")) {
+            if let Ok(p) = port.parse() {
+                self.http_port = p;
+            }
+        }
+        if self.socks5.is_none() {
+            self.socks5 = Socks5Config::from_env(self.product);
+        }
+        self
+    }
+
+    /// Build from config + credentials.
+    pub fn from_config(
+        product: &'static ProductProfile,
+        name: String,
+        config: &EnvironmentConfig,
+        creds: &EnvironmentCredentials,
+    ) -> Self {
+        Environment {
+            product,
+            name,
+            host: config.host.clone(),
+            mysql_port: config.mysql_port,
+            http_port: config.http_port,
+            user: config.user.clone(),
+            password: creds.password.clone(),
+            socks5: None,
+            cluster_routing_directive: None,
+        }
+    }
+}
diff --git a/src/config/mod.rs b/src/config/mod.rs
new file mode 100644
index 0000000..e80ffa4
--- /dev/null
+++ b/src/config/mod.rs
@@ -0,0 +1,5 @@
+pub mod environment;
+pub mod store;
+
+pub use environment::{Environment, Socks5Config};
+pub use store::Store;
diff --git a/src/config/store.rs b/src/config/store.rs
new file mode 100644
index 0000000..194f216
--- /dev/null
+++ b/src/config/store.rs
@@ -0,0 +1,269 @@
+use crate::config::environment::{Environment, EnvironmentConfig, EnvironmentCredentials};
+use crate::error::{VeloError, VeloResult};
+use crate::product::ProductProfile;
+use serde::{Deserialize, Serialize};
+use std::collections::BTreeMap;
+use std::path::PathBuf;
+
+/// Top-level config file structure (<product-config-dir>/config.toml).
+#[derive(Debug, Clone, Serialize, Deserialize, Default)]
+pub struct ConfigFile {
+    #[serde(default)]
+    pub default_env: Option<String>,
+    #[serde(default)]
+    pub environments: BTreeMap<String, EnvironmentConfig>,
+}
+
+/// Top-level credentials file structure (<product-config-dir>/credentials.toml).
+#[derive(Debug, Clone, Serialize, Deserialize, Default)]
+pub struct CredentialsFile {
+    #[serde(flatten)]
+    pub environments: BTreeMap<String, EnvironmentCredentials>,
+}
+
+/// The config store manages reading/writing config + credentials.
+#[derive(Debug)]
+pub struct Store {
+    pub product: &'static ProductProfile,
+    pub config: ConfigFile,
+    pub credentials: CredentialsFile,
+    config_dir: Option<PathBuf>,
+}
+
+impl Store {
+    /// True when `<PREFIX>_HOST` + `<PREFIX>_USER` are set. In this mode the CLI must
+    /// avoid all filesystem side effects — the bastion is multi-tenant and
+    /// writable home dirs are not guaranteed.
+    pub fn is_stateless(product: &ProductProfile) -> bool {
+        std::env::var(product.env_key("HOST")).is_ok()
+            && std::env::var(product.env_key("USER")).is_ok()
+    }
+
+    /// Build an in-memory Store with no backing files. `save()` refuses to
+    /// write. Used when `is_stateless()` is true.
+    pub fn stateless(product: &'static ProductProfile) -> Self {
+        Store {
+            product,
+            config: ConfigFile::default(),
+            credentials: CredentialsFile::default(),
+            config_dir: None,
+        }
+    }
+
+    /// Resolve an Environment purely from env vars. Never touches disk.
+    pub fn resolve_stateless(product: &'static ProductProfile, name: &str) -> Environment {
+        let host = std::env::var(product.env_key("HOST")).unwrap_or_default();
+        let user = std::env::var(product.env_key("USER")).unwrap_or_default();
+        let password = std::env::var(product.env_key("PASSWORD")).unwrap_or_default();
+        let mysql_port = std::env::var(product.env_key("PORT"))
+            .ok()
+            .and_then(|p| p.parse().ok())
+            .unwrap_or(9030);
+        let http_port = std::env::var(product.env_key("HTTP_PORT"))
+            .ok()
+            .and_then(|p| p.parse().ok())
+            .unwrap_or(8030);
+        Environment {
+            product,
+            name: name.to_string(),
+            host,
+            mysql_port,
+            http_port,
+            user,
+            password,
+            socks5: crate::config::Socks5Config::from_env(product),
+            cluster_routing_directive: None,
+        }
+    }
+
+    /// Load config from the product config directory (creates directory if needed).
+    /// In stateless mode, returns an in-memory Store with no filesystem I/O.
+    pub fn load(product: &'static ProductProfile) -> VeloResult<Self> {
+        if Self::is_stateless(product) {
+            return Ok(Self::stateless(product));
+        }
+
+        let config_dir = Self::config_dir(product)?;
+        std::fs::create_dir_all(&config_dir)
+            .map_err(|e| VeloError::config(format!("Failed to create config directory: {e}")))?;
+
+        let config_path = config_dir.join("config.toml");
+        let creds_path = config_dir.join("credentials.toml");
+
+        let config: ConfigFile = if config_path.exists() {
+            let text = std::fs::read_to_string(&config_path)
+                .map_err(|e| VeloError::config(format!("Failed to read config: {e}")))?;
+            toml::from_str(&text)
+                .map_err(|e| VeloError::config(format!("Invalid config.toml: {e}")))?
+        } else {
+            ConfigFile::default()
+        };
+
+        let credentials: CredentialsFile = if creds_path.exists() {
+            let text = std::fs::read_to_string(&creds_path)
+                .map_err(|e| VeloError::config(format!("Failed to read credentials: {e}")))?;
+            toml::from_str(&text)
+                .map_err(|e| VeloError::config(format!("Invalid credentials.toml: {e}")))?
+        } else {
+            CredentialsFile::default()
+        };
+
+        Ok(Store {
+            product,
+            config,
+            credentials,
+            config_dir: Some(config_dir),
+        })
+    }
+
+    /// Resolve an environment by name, applying env var overrides.
+    pub fn resolve_env(&self, name: &str) -> VeloResult<Environment> {
+        // Stateless shortcut — never touch config files.
+        if Self::is_stateless(self.product) {
+            return Ok(Self::resolve_stateless(self.product, name));
+        }
+
+        let env_config = self.config.environments.get(name).ok_or_else(|| {
+            if self.config.environments.is_empty() {
+                VeloError::AuthRequired
+            } else {
+                VeloError::EnvNotFound {
+                    name: name.to_string(),
+                }
+            }
+        })?;
+
+        let creds = self
+            .credentials
+            .environments
+            .get(name)
+            .cloned()
+            .unwrap_or_default();
+
+        let env = Environment::from_config(self.product, name.to_string(), env_config, &creds);
+        Ok(env.with_env_overrides())
+    }
+
+    /// Get the effective environment name (--env flag > <PREFIX>_ENV > config default).
+    pub fn effective_env_name(&self, flag: &str) -> String {
+        if flag != "default" {
+            return flag.to_string();
+        }
+        if let Ok(env_name) = std::env::var(self.product.env_key("ENV")) {
+            return env_name;
+        }
+        self.config
+            .default_env
+            .clone()
+            .unwrap_or_else(|| "default".to_string())
+    }
+
+    /// Get the effective environment source for diagnostics.
+    /// Returns (source_type, source_detail).
+    pub fn effective_env_source(&self, flag: &str) -> (&'static str, String) {
+        if flag != "default" {
+            return ("flag", format!("--env {flag}"));
+        }
+        let env_key = self.product.env_key("ENV");
+        if let Ok(name) = std::env::var(&env_key) {
+            return ("env_var", format!("{env_key}={name}"));
+        }
+        if let Some(ref name) = self.config.default_env {
+            return ("config", format!("default_env={name}"));
+        }
+        ("fallback", "no environment configured".to_string())
+    }
+
+    /// Add a new environment.
+    pub fn add_env(
+        &mut self,
+        name: &str,
+        config: EnvironmentConfig,
+        creds: EnvironmentCredentials,
+    ) -> VeloResult<()> {
+        self.config.environments.insert(name.to_string(), config);
+        self.credentials
+            .environments
+            .insert(name.to_string(), creds);
+
+        // Set as default if it's the first environment
+        if self.config.environments.len() == 1 {
+            self.config.default_env = Some(name.to_string());
+        }
+
+        self.save()
+    }
+
+    /// Set the default environment.
+    pub fn set_default(&mut self, name: &str) -> VeloResult<()> {
+        if !self.config.environments.contains_key(name) {
+            return Err(VeloError::EnvNotFound {
+                name: name.to_string(),
+            });
+        }
+        self.config.default_env = Some(name.to_string());
+        self.save()
+    }
+
+    /// List all environment names with their configs.
+    pub fn list_envs(&self) -> Vec<(String, &EnvironmentConfig, bool)> {
+        let default_name = self.config.default_env.as_deref().unwrap_or("default");
+        self.config
+            .environments
+            .iter()
+            .map(|(name, config)| (name.clone(), config, name == default_name))
+            .collect()
+    }
+
+    /// Remove an environment.
+    pub fn remove_env(&mut self, name: &str) -> VeloResult<()> {
+        self.config.environments.remove(name);
+        self.credentials.environments.remove(name);
+        if self.config.default_env.as_deref() == Some(name) {
+            self.config.default_env = self.config.environments.keys().next().cloned();
+        }
+        self.save()
+    }
+
+    /// Save config and credentials to disk.
+    fn save(&self) -> VeloResult<()> {
+        let config_dir = self.config_dir.as_ref().ok_or_else(|| {
+            VeloError::config(format!(
+                "Cannot modify config in stateless mode ({} + {} set). \
+                     Unset those env vars to use {}/ config files.",
+                self.product.env_key("HOST"),
+                self.product.env_key("USER"),
+                self.product.config_dir,
+            ))
+        })?;
+
+        let config_text = toml::to_string_pretty(&self.config)
+            .map_err(|e| VeloError::config(format!("Failed to serialize config: {e}")))?;
+        let creds_text = toml::to_string_pretty(&self.credentials)
+            .map_err(|e| VeloError::config(format!("Failed to serialize credentials: {e}")))?;
+
+        let config_path = config_dir.join("config.toml");
+        let creds_path = config_dir.join("credentials.toml");
+
+        std::fs::write(&config_path, config_text)
+            .map_err(|e| VeloError::config(format!("Failed to write config: {e}")))?;
+        std::fs::write(&creds_path, creds_text)
+            .map_err(|e| VeloError::config(format!("Failed to write credentials: {e}")))?;
+
+        // Set restrictive permissions on credentials file (Unix only)
+        #[cfg(unix)]
+        {
+            use std::os::unix::fs::PermissionsExt;
+            let perms = std::fs::Permissions::from_mode(0o600);
+            let _ = std::fs::set_permissions(&creds_path, perms);
+        }
+
+        Ok(())
+    }
+
+    fn config_dir(product: &ProductProfile) -> VeloResult<PathBuf> {
+        let home =
+            dirs::home_dir().ok_or_else(|| VeloError::config("Cannot determine home directory"))?;
+        Ok(home.join(&product.config_dir))
+    }
+}
diff --git a/src/connection/http.rs b/src/connection/http.rs
new file mode 100644
index 0000000..9ead709
--- /dev/null
+++ b/src/connection/http.rs
@@ -0,0 +1,290 @@
+use crate::config::Environment;
+use crate::error::{VeloError, VeloResult};
+use serde_json::Value;
+
+pub struct HttpConnection {
+    client: reqwest::Client,
+    base_url: String,
+    user: String,
+    password: String,
+}
+
+/// Outcome of probing a single HTTP endpoint.
+#[derive(Debug, Clone)]
+pub struct ProbeResult {
+    pub url: String,
+    pub status: ProbeStatus,
+}
+
+#[derive(Debug, Clone)]
+pub enum ProbeStatus {
+    /// 2xx response — endpoint is reachable and auth succeeded.
+    Ok,
+    /// Non-2xx HTTP response — port is open, but endpoint/auth is off.
+    Http(u16),
+    /// Network/timeout/DNS failure — port is likely wrong or service down.
+    Unreachable(String),
+}
+
+impl ProbeStatus {
+    pub fn is_ok(&self) -> bool {
+        matches!(self, ProbeStatus::Ok)
+    }
+
+    pub fn short(&self) -> String {
+        match self {
+            ProbeStatus::Ok => "ok".to_string(),
+            ProbeStatus::Http(c) => format!("http {c}"),
+            ProbeStatus::Unreachable(e) => format!("unreachable: {e}"),
+        }
+    }
+}
+
+/// Aggregate HTTP health of the configured FE.
+#[derive(Debug, Clone)]
+pub struct HttpProbe {
+    pub rest_v2: ProbeResult,
+    pub legacy: ProbeResult,
+}
+
+impl HttpProbe {
+    pub fn any_ok(&self) -> bool {
+        self.rest_v2.status.is_ok() || self.legacy.status.is_ok()
+    }
+}
+
+impl HttpConnection {
+    pub fn new(env: &Environment) -> Self {
+        let mut builder = reqwest::Client::builder()
+            .timeout(std::time::Duration::from_secs(30))
+            .connect_timeout(std::time::Duration::from_secs(5));
+
+        if let Some(s5) = &env.socks5 {
+            // socks5h:// → DNS resolved on the proxy side (target hostnames may
+            // only exist inside the customer VPC in BYOC).
+            let proxy_url = format!("socks5h://{}:{}", s5.host, s5.port);
+            match reqwest::Proxy::all(&proxy_url) {
+                Ok(p) => {
+                    builder = builder.proxy(p.basic_auth(&s5.user, &s5.pass));
+                }
+                Err(e) => {
+                    tracing::warn!(
+                        target = "velo::socks5",
+                        "Invalid SOCKS5 proxy URL '{proxy_url}': {e} — HTTP will go direct"
+                    );
+                }
+            }
+        }
+
+        HttpConnection {
+            client: builder.build().unwrap_or_default(),
+            base_url: format!("http://{}:{}", env.host, env.http_port),
+            user: env.user.clone(),
+            password: env.password.clone(),
+        }
+    }
+
+    /// Build a connection for a specific host:port, reusing env's credentials + socks5.
+    /// Used when fanning out to other FEs (via SHOW FRONTENDS) or probing alternative ports.
+    pub fn for_target(env: &Environment, host: &str, http_port: u16) -> Self {
+        let mut builder = reqwest::Client::builder()
+            .timeout(std::time::Duration::from_secs(30))
+            .connect_timeout(std::time::Duration::from_secs(5));
+
+        if let Some(s5) = &env.socks5 {
+            let proxy_url = format!("socks5h://{}:{}", s5.host, s5.port);
+            if let Ok(p) = reqwest::Proxy::all(&proxy_url) {
+                builder = builder.proxy(p.basic_auth(&s5.user, &s5.pass));
+            }
+        }
+
+        HttpConnection {
+            client: builder.build().unwrap_or_default(),
+            base_url: format!("http://{host}:{http_port}"),
+            user: env.user.clone(),
+            password: env.password.clone(),
+        }
+    }
+
+    /// Probe REST v2 + legacy HTTP endpoints with a short timeout.
+    /// Used by `auth add` / `auth status` to surface connectivity issues
+    /// early, rather than letting them explode later inside `profile get`.
+    pub async fn probe(&self) -> HttpProbe {
+        let rest_v2_url = format!(
+            "{}/rest/v2/manager/query/query_info?is_all_node=true",
+            self.base_url
+        );
+        let legacy_url = format!("{}/api/health", self.base_url);
+
+        let rest_v2 = self.probe_one(&rest_v2_url).await;
+        let legacy = self.probe_one(&legacy_url).await;
+
+        HttpProbe { rest_v2, legacy }
+    }
+
+    async fn probe_one(&self, url: &str) -> ProbeResult {
+        let resp = self
+            .client
+            .get(url)
+            .basic_auth(&self.user, Some(&self.password))
+            .timeout(std::time::Duration::from_secs(3))
+            .send()
+            .await;
+
+        let status = match resp {
+            Ok(r) => {
+                let code = r.status().as_u16();
+                if (200..300).contains(&code) {
+                    ProbeStatus::Ok
+                } else {
+                    ProbeStatus::Http(code)
+                }
+            }
+            Err(e) => ProbeStatus::Unreachable(short_err(&e)),
+        };
+
+        ProbeResult {
+            url: url.to_string(),
+            status,
+        }
+    }
+}
+
+/// Collapse reqwest's verbose error chain into one short line for probe output.
+fn short_err(e: &reqwest::Error) -> String {
+    if e.is_timeout() {
+        "timeout".to_string()
+    } else if e.is_connect() {
+        "connection refused".to_string()
+    } else if e.is_request() {
+        "request failed".to_string()
+    } else {
+        e.to_string().chars().take(120).collect()
+    }
+}
+
+impl HttpConnection {
+    /// Fetch profile text via REST v2 Manager API (works on VeloDB Cloud port 8080).
+    /// Endpoint: GET /rest/v2/manager/query/profile/text/{query_id}?is_all_node=true
+    /// Response: {"msg":"success","code":0,"data":{"profile":"Summary:\n..."}}
+    pub async fn get_profile_text_v2(&self, query_id: &str) -> VeloResult<String> {
+        let url = format!(
+            "{}/rest/v2/manager/query/profile/text/{}?is_all_node=true",
+            self.base_url, query_id
+        );
+
+        let resp = self
+            .client
+            .get(&url)
+            .basic_auth(&self.user, Some(&self.password))
+            .send()
+            .await
+            .map_err(|e| {
+                VeloError::connection_with_source(
+                    format!("REST v2 profile request failed: {url}"),
+                    e,
+                )
+            })?;
+
+        let status = resp.status().as_u16();
+        if status != 200 {
+            let body = resp.text().await.unwrap_or_default();
+            return Err(VeloError::Http { status, body });
+        }
+
+        let json: Value = resp.json().await.map_err(|e| VeloError::Http {
+            status,
+            body: format!("Failed to parse JSON response: {e}"),
+        })?;
+
+        // Check response envelope
+        let code = json.get("code").and_then(|v| v.as_i64()).unwrap_or(-1);
+        if code != 0 {
+            let msg = json
+                .get("data")
+                .and_then(|v| v.as_str())
+                .or_else(|| json.get("msg").and_then(|v| v.as_str()))
+                .unwrap_or("Unknown error");
+            return Err(VeloError::Http {
+                status,
+                body: msg.to_string(),
+            });
+        }
+
+        // Extract profile text from data.profile
+        json.get("data")
+            .and_then(|d| d.get("profile"))
+            .and_then(|p| p.as_str())
+            .map(|s| s.to_string())
+            .ok_or_else(|| VeloError::Parse("No 'profile' field in REST v2 response".to_string()))
+    }
+
+    /// Fetch profile text from legacy FE HTTP API.
+    /// Endpoint: GET /api/profile/text/{query_id}
+    pub async fn get_profile_text(&self, query_id: &str) -> VeloResult<String> {
+        let url = format!("{}/api/profile/text/{}", self.base_url, query_id);
+        let resp = self
+            .client
+            .get(&url)
+            .basic_auth(&self.user, Some(&self.password))
+            .send()
+            .await
+            .map_err(|e| {
+                VeloError::connection_with_source(format!("HTTP request failed: {url}"), e)
+            })?;
+
+        let status = resp.status().as_u16();
+        let body = resp.text().await.map_err(|e| VeloError::Http {
+            status,
+            body: e.to_string(),
+        })?;
+
+        if status != 200 {
+            return Err(VeloError::Http { status, body });
+        }
+
+        Ok(body)
+    }
+
+    /// Fetch list of recent queries via REST v2 Manager API.
+    /// Endpoint: GET /rest/v2/manager/query/query_info?is_all_node=true
+    #[allow(dead_code)]
+    pub async fn get_query_list(&self) -> VeloResult<Value> {
+        let url = format!(
+            "{}/rest/v2/manager/query/query_info?is_all_node=true",
+            self.base_url
+        );
+
+        let resp = self
+            .client
+            .get(&url)
+            .basic_auth(&self.user, Some(&self.password))
+            .send()
+            .await
+            .map_err(|e| {
+                VeloError::connection_with_source(format!("REST v2 query list failed: {url}"), e)
+            })?;
+
+        let json: Value = resp.json().await.map_err(|e| VeloError::Http {
+            status: 0,
+            body: format!("Failed to parse JSON: {e}"),
+        })?;
+
+        Ok(json)
+    }
+
+    /// Test HTTP connectivity.
+    #[allow(dead_code)]
+    pub async fn ping(&self) -> VeloResult<u128> {
+        let start = std::time::Instant::now();
+        let url = format!("{}/api/health", self.base_url);
+        let _ = self
+            .client
+            .get(&url)
+            .basic_auth(&self.user, Some(&self.password))
+            .timeout(std::time::Duration::from_secs(5))
+            .send()
+            .await;
+        Ok(start.elapsed().as_millis())
+    }
+}
diff --git a/src/connection/mod.rs b/src/connection/mod.rs
new file mode 100644
index 0000000..da5f344
--- /dev/null
+++ b/src/connection/mod.rs
@@ -0,0 +1,6 @@
+pub mod http;
+pub mod mysql;
+pub mod socks5_forwarder;
+
+pub use self::http::{HttpConnection, HttpProbe, ProbeStatus};
+pub use self::mysql::MysqlConnection;
diff --git a/src/connection/mysql.rs b/src/connection/mysql.rs
new file mode 100644
index 0000000..81174af
--- /dev/null
+++ b/src/connection/mysql.rs
@@ -0,0 +1,156 @@
+use crate::config::Environment;
+use crate::connection::socks5_forwarder::Socks5Forwarder;
+use crate::error::{VeloError, VeloResult};
+use mysql_async::prelude::*;
+use mysql_async::{Conn, Opts, OptsBuilder, Row, Value as MysqlValue};
+use serde_json::{Map, Value};
+pub struct MysqlConnection {
+    conn: Conn,
+    // Kept alive for the lifetime of the MySQL connection when SOCKS5 is in use.
+    // Dropping it aborts the listener task; must outlive `conn`.
+    #[allow(dead_code)]
+    forwarder: Option<Socks5Forwarder>,
+}
+
+/// Result of a SQL query execution.
+pub struct QueryResult {
+    pub columns: Vec<String>,
+    pub rows: Vec<Map<String, Value>>,
+}
+
+impl MysqlConnection {
+    /// Connect to a Doris/VeloDB instance. Routes through SOCKS5 when `env.socks5`
+    /// is set, via a loopback forwarder (mysql_async 0.34 has no native proxy hook).
+    pub async fn connect(env: &Environment) -> VeloResult<Self> {
+        let (dial_host, dial_port, forwarder, error_hint) = if let Some(s5) = &env.socks5 {
+            let fwd = Socks5Forwarder::spawn(s5, env.host.clone(), env.mysql_port).await?;
+            let port = fwd.local_addr.port();
+            let hint = format!(" via socks5://{}:{}", s5.host, s5.port);
+            ("127.0.0.1".to_string(), port, Some(fwd), hint)
+        } else {
+            (env.host.clone(), env.mysql_port, None, String::new())
+        };
+
+        let opts = OptsBuilder::default()
+            .ip_or_hostname(&dial_host)
+            .tcp_port(dial_port)
+            .user(Some(&env.user))
+            .pass(Some(&env.password))
+            .prefer_socket(false);
+
+        let pool = mysql_async::Pool::new(Opts::from(opts));
+        let conn = pool.get_conn().await.map_err(|e| {
+            VeloError::connection_with_source(
+                format!(
+                    "Failed to connect to {}:{} as '{}'{}",
+                    env.host, env.mysql_port, env.user, error_hint
+                ),
+                e,
+            )
+        })?;
+
+        let mut session = MysqlConnection { conn, forwarder };
+
+        // Run the post-connect init directive (e.g. `USE @<compute-group>`),
+        // sourced from `--init-sql` / `DORIS_INIT_SQL`. Never persisted.
+        if let Some(directive) = &env.cluster_routing_directive {
+            session.exec(directive).await?;
+        }
+
+        Ok(session)
+    }
+
+    /// Execute a SQL query and return structured results.
+    pub async fn query(&mut self, sql: &str) -> VeloResult<QueryResult> {
+        let rows: Vec<Row> = self
+            .conn
+            .query(sql)
+            .await
+            .map_err(|e| VeloError::sql(format!("{e}")))?;
+
+        if rows.is_empty() {
+            return Ok(QueryResult {
+                columns: Vec::new(),
+                rows: Vec::new(),
+            });
+        }
+
+        // Extract column names from first row
+        let columns: Vec<String> = rows[0]
+            .columns_ref()
+            .iter()
+            .map(|c| c.name_str().to_string())
+            .collect();
+
+        let mut result_rows = Vec::with_capacity(rows.len());
+        for row in &rows {
+            let mut map = Map::new();
+            for (i, col_name) in columns.iter().enumerate() {
+                let value = mysql_value_to_json(row.as_ref(i));
+                map.insert(col_name.clone(), value);
+            }
+            result_rows.push(map);
+        }
+
+        Ok(QueryResult {
+            columns,
+            rows: result_rows,
+        })
+    }
+
+    /// Execute a statement that doesn't return results (SET, USE, etc.).
+    pub async fn exec(&mut self, sql: &str) -> VeloResult<()> {
+        self.conn
+            .query_drop(sql)
+            .await
+            .map_err(|e| VeloError::sql(format!("{e}")))?;
+        Ok(())
+    }
+
+    /// Get the last query ID from the current session.
+    pub async fn last_query_id(&mut self) -> VeloResult<String> {
+        let result = self.query("SELECT last_query_id()").await?;
+        if let Some(row) = result.rows.first() {
+            if let Some(Value::String(qid)) = row.values().next() {
+                return Ok(qid.clone());
+            }
+        }
+        Ok(String::new())
+    }
+
+    /// Test connection by running SELECT 1, returns latency in ms.
+    pub async fn ping(&mut self) -> VeloResult<u128> {
+        let start = std::time::Instant::now();
+        self.query("SELECT 1").await?;
+        Ok(start.elapsed().as_millis())
+    }
+}
+
+/// Convert a mysql_async Value to serde_json Value.
+fn mysql_value_to_json(value: Option<&MysqlValue>) -> Value {
+    match value {
+        None | Some(MysqlValue::NULL) => Value::Null,
+        Some(MysqlValue::Bytes(bytes)) => {
+            let s = String::from_utf8_lossy(bytes).to_string();
+            // Try to parse as number first
+            if let Ok(n) = s.parse::<i64>() {
+                Value::Number(n.into())
+            } else if let Ok(n) = s.parse::<f64>() {
+                serde_json::Number::from_f64(n)
+                    .map(Value::Number)
+                    .unwrap_or(Value::String(s))
+            } else {
+                Value::String(s)
+            }
+        }
+        Some(MysqlValue::Int(n)) => Value::Number((*n).into()),
+        Some(MysqlValue::UInt(n)) => Value::Number((*n).into()),
+        Some(MysqlValue::Float(n)) => serde_json::Number::from_f64(*n as f64)
+            .map(Value::Number)
+            .unwrap_or(Value::Null),
+        Some(MysqlValue::Double(n)) => serde_json::Number::from_f64(*n)
+            .map(Value::Number)
+            .unwrap_or(Value::Null),
+        Some(other) => Value::String(format!("{other:?}")),
+    }
+}
diff --git a/src/connection/socks5_forwarder.rs b/src/connection/socks5_forwarder.rs
new file mode 100644
index 0000000..b4cd9d7
--- /dev/null
+++ b/src/connection/socks5_forwarder.rs
@@ -0,0 +1,87 @@
+//! Loopback TCP → SOCKS5 forwarder.
+//!
+//! mysql_async 0.34 has no hook to inject a pre-dialed stream (`Endpoint` enum
+//! is closed, `OptsBuilder` exposes only direct TCP knobs). So to route MySQL
+//! through a SOCKS5 proxy we bind an ephemeral loopback listener, point
+//! mysql_async at it, and tunnel each accepted connection through the proxy
+//! via `tokio-socks` + `copy_bidirectional`.
+//!
+//! The forwarder must outlive the MySQL connection — store the returned handle
+//! on the connection struct and let Drop abort the accept task.
+
+use crate::config::Socks5Config;
+use crate::error::{VeloError, VeloResult};
+use std::net::SocketAddr;
+use tokio::net::TcpListener;
+use tokio::task::JoinHandle;
+use tokio_socks::tcp::Socks5Stream;
+
+pub struct Socks5Forwarder {
+    pub local_addr: SocketAddr,
+    task: JoinHandle<()>,
+}
+
+impl Socks5Forwarder {
+    /// Bind an ephemeral loopback port and start forwarding every accepted
+    /// connection through the SOCKS5 proxy to `target_host:target_port`.
+    pub async fn spawn(
+        socks5: &Socks5Config,
+        target_host: String,
+        target_port: u16,
+    ) -> VeloResult<Self> {
+        let listener = TcpListener::bind("127.0.0.1:0").await.map_err(|e| {
+            VeloError::connection_with_source(
+                "Failed to bind SOCKS5 forwarder loopback listener".to_string(),
+                e,
+            )
+        })?;
+        let local_addr = listener.local_addr().map_err(|e| {
+            VeloError::connection_with_source(
+                "Failed to read SOCKS5 forwarder local addr".to_string(),
+                e,
+            )
+        })?;
+
+        let s5 = socks5.clone();
+        let task = tokio::spawn(async move {
+            loop {
+                let (mut inbound, _peer) = match listener.accept().await {
+                    Ok(pair) => pair,
+                    Err(_) => return,
+                };
+                let s5 = s5.clone();
+                let host = target_host.clone();
+                let port = target_port;
+                tokio::spawn(async move {
+                    let proxy_addr = format!("{}:{}", s5.host, s5.port);
+                    let mut outbound = match Socks5Stream::connect_with_password(
+                        proxy_addr.as_str(),
+                        (host.as_str(), port),
+                        &s5.user,
+                        &s5.pass,
+                    )
+                    .await
+                    {
+                        Ok(s) => s,
+                        Err(e) => {
+                            tracing::warn!(
+                                target = "velo::socks5",
+                                "SOCKS5 dial to {host}:{port} via {proxy_addr} failed: {e}"
+                            );
+                            return;
+                        }
+                    };
+                    let _ = tokio::io::copy_bidirectional(&mut inbound, &mut outbound).await;
+                });
+            }
+        });
+
+        Ok(Socks5Forwarder { local_addr, task })
+    }
+}
+
+impl Drop for Socks5Forwarder {
+    fn drop(&mut self) {
+        self.task.abort();
+    }
+}
diff --git a/src/error.rs b/src/error.rs
new file mode 100644
index 0000000..d1628ab
--- /dev/null
+++ b/src/error.rs
@@ -0,0 +1,90 @@
+use crate::product::ProductProfile;
+
+#[derive(Debug, thiserror::Error)]
+pub enum VeloError {
+    #[error("Connection failed: {message}")]
+    Connection {
+        message: String,
+        #[source]
+        source: Option<Box<dyn std::error::Error + Send + Sync>>,
+    },
+
+    #[error("SQL error: {message}")]
+    Sql { message: String },
+
+    #[error("Profile parse error: {0}")]
+    #[allow(dead_code)]
+    Parse(String),
+
+    #[error("Configuration error: {0}")]
+    Config(String),
+
+    #[error("HTTP error [{status}]: {body}")]
+    Http { status: u16, body: String },
+
+    #[error("Environment '{name}' not found.")]
+    EnvNotFound { name: String },
+
+    #[error("Authentication required.")]
+    AuthRequired,
+
+    #[error("IO error: {0}")]
+    Io(#[from] std::io::Error),
+}
+
+impl VeloError {
+    pub fn connection_with_source(
+        msg: impl Into<String>,
+        src: impl std::error::Error + Send + Sync + 'static,
+    ) -> Self {
+        VeloError::Connection {
+            message: msg.into(),
+            source: Some(Box::new(src)),
+        }
+    }
+
+    pub fn sql(msg: impl Into<String>) -> Self {
+        VeloError::Sql {
+            message: msg.into(),
+        }
+    }
+
+    pub fn config(msg: impl Into<String>) -> Self {
+        VeloError::Config(msg.into())
+    }
+
+    #[allow(dead_code)]
+    pub fn parse(msg: impl Into<String>) -> Self {
+        VeloError::Parse(msg.into())
+    }
+}
+
+/// Result type alias for VeloError
+pub type VeloResult<T> = Result<T, VeloError>;
+
+/// Format a VeloError for user-facing display
+impl VeloError {
+    pub fn user_message(&self, product: &ProductProfile) -> String {
+        match self {
+            VeloError::Connection { message, .. } => {
+                format!(
+                    "Error: {message}\n\nCheck your connection settings with `{} auth status`.",
+                    product.binary
+                )
+            }
+            VeloError::EnvNotFound { name } => {
+                format!(
+                    "Error: Environment '{name}' not found.\n\nRun `{} auth list` to see available environments.",
+                    product.binary
+                )
+            }
+            VeloError::AuthRequired => {
+                format!(
+                    "Error: No authentication configured.\n\nRun `{} auth add <name> --host <host> --user <user> --password <pass>` to get started.",
+                    product.binary
+                )
+            }
+            other => format!("Error: {other}"),
+        }
+    }
+}
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..ca2454e
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,107 @@
+mod cli;
+mod commands;
+mod config;
+mod connection;
+mod error;
+mod models;
+mod output;
+mod parser;
+mod product;
+
+use crate::cli::{Cli, Command};
+use crate::product::{get_product, ProductProfile};
+
+#[tokio::main]
+async fn main() {
+    main_for(get_product("doris")).await;
+}
+
+async fn main_for(product: &'static ProductProfile) {
+    let cli = Cli::parse_for(product);
+
+    tracing_subscriber::fmt()
+        .with_env_filter(
+            tracing_subscriber::EnvFilter::from_default_env()
+                .add_directive(tracing::Level::WARN.into()),
+        )
+        .with_target(false)
+        .without_time()
+        .init();
+
+    let format = crate::output::format::resolve(cli.format);
+    let result = run_command(cli, product).await;
+
+    match result {
+        Ok(value) => {
+            if let Err(e) = crate::output::render(&value, format) {
+                eprintln!("Error: {e}");
+                std::process::exit(1);
+            }
+        }
+        Err(e) => {
+            if let Some(velo_err) = e.downcast_ref::<crate::error::VeloError>() {
+                eprintln!("{}", velo_err.user_message(product));
+            } else {
+                eprintln!("Error: {e}");
+            }
+            std::process::exit(1);
+        }
+    }
+}
+
+async fn run_command(
+    cli: Cli,
+    product: &'static ProductProfile,
+) -> anyhow::Result<serde_json::Value> {
+    let socks5_flag = match cli.socks5.as_deref() {
+        Some(s) => Some(crate::config::Socks5Config::parse_flag(s)?),
+        None => None,
+    };
+
+    // `--init-sql` (flag) > DORIS_INIT_SQL (env) becomes the session's
+    // post-connect directive — e.g. `USE @<compute-group>` handed off from
+    // `cloudcli cloud endpoint --export`. MysqlConnection::connect applies it.
+    let init_sql = cli
+        .init_sql
+        .clone()
+        .or_else(|| std::env::var(product.env_key("INIT_SQL")).ok());
+
+    let apply = |mut env: crate::config::Environment| {
+        if socks5_flag.is_some() {
+            env.socks5 = socks5_flag.clone();
+        }
+        if init_sql.is_some() {
+            env.cluster_routing_directive = init_sql.clone();
+        }
+        env
+    };
+
+    match cli.command {
+        Command::Use(args) => {
+            let mut store = crate::config::Store::load(product)?;
+            crate::commands::use_env::run(args, &mut store)
+        }
+        Command::Auth(cmd) => {
+            let mut store = crate::config::Store::load(product)?;
+            crate::commands::auth::run(cmd, &mut store, &cli.env).await
+        }
+        Command::Sql(args) => {
+            let store = crate::config::Store::load(product)?;
+            let env_name = store.effective_env_name(&cli.env);
+            let env = apply(store.resolve_env(&env_name)?);
+            crate::commands::sql::run(args, &env).await
+        }
+        Command::Tablet(args) => {
+            let store = crate::config::Store::load(product)?;
+            let env_name = store.effective_env_name(&cli.env);
+            let env = apply(store.resolve_env(&env_name)?);
+            crate::commands::tablet::run(args, &env).await
+        }
+        Command::Profile(cmd) => {
+            let store = crate::config::Store::load(product)?;
+            let env_name = store.effective_env_name(&cli.env);
+            let env = apply(store.resolve_env(&env_name)?);
+            crate::commands::profile::run(cmd, &env).await
+        }
+    }
+}
diff --git a/src/models/load.rs b/src/models/load.rs
new file mode 100644
index 0000000..e4c0aa5
--- /dev/null
+++ b/src/models/load.rs
@@ -0,0 +1,2 @@
+// Load models are represented as serde_json::Value directly.
+// See commands/load/*.rs for response shapes.
diff --git a/src/models/mod.rs b/src/models/mod.rs
new file mode 100644
index 0000000..e279c86
--- /dev/null
+++ b/src/models/mod.rs
@@ -0,0 +1,4 @@
+pub mod load;
+pub mod profile;
+pub mod sql;
+pub mod tablet;
diff --git a/src/models/profile.rs b/src/models/profile.rs
new file mode 100644
index 0000000..b018d50
--- /dev/null
+++ b/src/models/profile.rs
@@ -0,0 +1,238 @@
+use serde::{Deserialize, Serialize};
+use std::collections::HashMap;
+
+// ─── Aggregate Value (Doris "sum X, avg Y, max Z, min W") ───
+
+#[derive(Debug, Clone, Serialize, Deserialize, Default)]
+pub struct AggValue {
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub sum: Option<f64>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub avg: Option<f64>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub max: Option<f64>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub min: Option<f64>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub raw: Option<String>,
+}
+
+impl AggValue {
+    /// The best representative value.
+    #[allow(dead_code)]
+    pub fn representative(&self) -> f64 {
+        self.avg.or(self.sum).unwrap_or(0.0)
+    }
+
+    /// Skew ratio: max / avg.
+    pub fn skew_ratio(&self) -> Option<f64> {
+        match (self.max, self.avg) {
+            (Some(max), Some(avg)) if avg > 0.0 => Some(max / avg),
+            _ => None,
+        }
+    }
+}
+
+// ─── Operator Info ───
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct OperatorInfoModel {
+    pub full_name: String,
+    pub operator_type: String,
+    pub id: i32,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub nereids_id: Option<i32>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub table_name: Option<String>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub dest_id: Option<i32>,
+    pub is_sink: bool,
+}
+
+// ─── Operator Metrics ───
+
+#[derive(Debug, Clone, Serialize, Deserialize, Default)]
+pub struct OperatorMetrics {
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub exec_time: Option<AggValue>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub input_rows: Option<AggValue>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub rows_produced: Option<AggValue>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub memory_usage: Option<AggValue>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub memory_usage_peak: Option<AggValue>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub open_time: Option<AggValue>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub close_time: Option<AggValue>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub init_time: Option<AggValue>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub wait_for_dependency_time: Option<AggValue>,
+}
+
+// ─── Operator ───
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct Operator {
+    pub info: OperatorInfoModel,
+    pub metrics: OperatorMetrics,
+    #[serde(default, skip_serializing_if = "HashMap::is_empty")]
+    pub all_counters: HashMap<String, AggValue>,
+    #[serde(default, skip_serializing_if = "HashMap::is_empty")]
+    pub plan_info: HashMap<String, String>,
+}
+
+// ─── Pipeline ───
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct Pipeline {
+    pub id: i32,
+    pub instance_num: i32,
+    pub operators: Vec<Operator>,
+}
+
+// ─── Fragment ───
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct Fragment {
+    pub id: i32,
+    pub pipelines: Vec<Pipeline>,
+}
+
+// ─── Profile Summary ───
+
+#[derive(Debug, Clone, Serialize, Deserialize, Default)]
+pub struct ProfileSummary {
+    pub query_id: String,
+    pub total_time: String,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub total_time_ms: Option<f64>,
+    pub state: String,
+    pub sql: String,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub doris_version: Option<String>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub is_nereids: Option<bool>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub is_cached: Option<bool>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub total_instances: Option<u32>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub user: Option<String>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub start_time: Option<String>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub end_time: Option<String>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub default_db: Option<String>,
+}
+
+// ─── Execution Summary ───
+
+#[derive(Debug, Clone, Serialize, Deserialize, Default)]
+pub struct ExecutionSummary {
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub parse_sql_time: Option<String>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub plan_time: Option<String>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub schedule_time: Option<String>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub wait_fetch_result_time: Option<String>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub fetch_result_time: Option<String>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub write_result_time: Option<String>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub nereids_analysis_time: Option<String>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub nereids_rewrite_time: Option<String>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub nereids_optimize_time: Option<String>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub workload_group: Option<String>,
+}
+
+// ─── Session Variable ───
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct SessionVar {
+    pub name: String,
+    pub current_value: String,
+    pub default_value: String,
+}
+
+// ─── Full Profile ───
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct DorisProfile {
+    pub summary: ProfileSummary,
+    pub execution_summary: ExecutionSummary,
+    pub changed_session_vars: Vec<SessionVar>,
+    pub fragments: Vec<Fragment>,
+}
+
+// ─── Flat Operator (for Level 0/1 output) ───
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct FlatOperator {
+    pub name: String,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub table: Option<String>,
+    pub frag: i32,
+    pub pipeline: i32,
+    pub exec_time_avg_ms: f64,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub input_rows: Option<f64>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub output_rows: Option<f64>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub skew_ratio: Option<f64>,
+    pub time_pct: f64,
+
+    // ─── Diagnostic fields (user feedback items 3-6) ───
+    /// Selectivity: input_rows / output_rows. High ratio = bad key/filter.
+    /// >1000 on scan = wrong sort key. >100 on join = missing runtime filter.
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub selectivity: Option<f64>,
+
+    /// True if this operator spilled to disk (SpillWriteBytes > 0).
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub spilled: Option<bool>,
+
+    /// Peak memory in bytes for this operator.
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub peak_mem_bytes: Option<f64>,
+
+    /// True if wait_time > exec_time * 2 — bottleneck is upstream, not here.
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub blocked_on_upstream: Option<bool>,
+
+    /// Wait-for-dependency time in ms.
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub wait_time_ms: Option<f64>,
+
+    /// Runtime filter info extracted from PlanInfo (e.g., "RF0[col->col](ndv/size)")
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub runtime_filters: Option<Vec<String>>,
+
+    // ─── Infrastructure metrics (surfaced from all_counters) ───
+    /// Network shuffle bytes sent by this operator (exchange/data_stream).
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub shuffle_bytes: Option<f64>,
+
+    /// File cache hit percentage for scan operators.
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub cache_hit_pct: Option<f64>,
+
+    /// Rows filtered by bloom filter / zonemap / runtime filter at scan.
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub rows_filtered: Option<f64>,
+
+    /// Join type: shuffle, broadcast, colocated, bucket_shuffle.
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub join_type: Option<String>,
+}
diff --git a/src/models/sql.rs b/src/models/sql.rs
new file mode 100644
index 0000000..b988719
--- /dev/null
+++ b/src/models/sql.rs
@@ -0,0 +1,3 @@
+// SQL models are represented as serde_json::Value directly
+// since Doris returns dynamic column sets.
+// See commands/sql.rs for the response shape.
diff --git a/src/models/tablet.rs b/src/models/tablet.rs
new file mode 100644
index 0000000..f1f7d78
--- /dev/null
+++ b/src/models/tablet.rs
@@ -0,0 +1,3 @@
+// Tablet models are represented as serde_json::Value directly
+// since the structure varies by level.
+// See commands/tablet/*.rs for response shapes.
diff --git a/src/output/csv.rs b/src/output/csv.rs
new file mode 100644
index 0000000..7ea9bf4
--- /dev/null
+++ b/src/output/csv.rs
@@ -0,0 +1,58 @@
+use serde_json::Value;
+
+/// Render a JSON value as CSV to stdout.
+pub fn render(value: &Value) -> anyhow::Result<()> {
+    match value {
+        Value::Array(arr) if !arr.is_empty() => render_array(arr),
+        _ => {
+            // Fallback to JSON for non-tabular data
+            super::json::render(value)
+        }
+    }
+}
+
+fn render_array(arr: &[Value]) -> anyhow::Result<()> {
+    // Collect columns
+    let mut columns: Vec<String> = Vec::new();
+    for item in arr {
+        if let Value::Object(obj) = item {
+            for key in obj.keys() {
+                if !columns.contains(key) {
+                    columns.push(key.clone());
+                }
+            }
+        }
+    }
+
+    // Header
+    println!("{}", columns.join(","));
+
+    // Rows
+    for item in arr {
+        if let Value::Object(obj) = item {
+            let row: Vec<String> = columns
+                .iter()
+                .map(|col| csv_escape(obj.get(col).unwrap_or(&Value::Null)))
+                .collect();
+            println!("{}", row.join(","));
+        }
+    }
+
+    Ok(())
+}
+
+fn csv_escape(value: &Value) -> String {
+    let s = match value {
+        Value::Null => String::new(),
+        Value::String(s) => s.clone(),
+        Value::Number(n) => n.to_string(),
+        Value::Bool(b) => b.to_string(),
+        other => serde_json::to_string(other).unwrap_or_default(),
+    };
+
+    if s.contains(',') || s.contains('"') || s.contains('\n') {
+        format!("\"{}\"", s.replace('"', "\"\""))
+    } else {
+        s
+    }
+}
diff --git a/src/output/format.rs b/src/output/format.rs
new file mode 100644
index 0000000..7d2c420
--- /dev/null
+++ b/src/output/format.rs
@@ -0,0 +1,31 @@
+use clap::ValueEnum;
+
+#[derive(Debug, Clone, Copy, PartialEq, ValueEnum)]
+pub enum OutputFormatArg {
+    Json,
+    Table,
+    Csv,
+}
+
+#[derive(Debug, Clone, Copy, PartialEq)]
+pub enum OutputFormat {
+    Json,
+    Table,
+    Csv,
+}
+
+/// Resolve the output format: explicit flag > TTY detection.
+pub fn resolve(explicit: Option<OutputFormatArg>) -> OutputFormat {
+    match explicit {
+        Some(OutputFormatArg::Json) => OutputFormat::Json,
+        Some(OutputFormatArg::Table) => OutputFormat::Table,
+        Some(OutputFormatArg::Csv) => OutputFormat::Csv,
+        None => {
+            if is_terminal::is_terminal(std::io::stdout()) {
+                OutputFormat::Table
+            } else {
+                OutputFormat::Json
+            }
+        }
+    }
+}
diff --git a/src/output/json.rs b/src/output/json.rs
new file mode 100644
index 0000000..d1daffa
--- /dev/null
+++ b/src/output/json.rs
@@ -0,0 +1,8 @@
+use serde_json::Value;
+
+/// Render a JSON value as pretty-printed JSON to stdout.
+pub fn render(value: &Value) -> anyhow::Result<()> {
+    let output = serde_json::to_string_pretty(value)?;
+    println!("{output}");
+    Ok(())
+}
diff --git a/src/output/mod.rs b/src/output/mod.rs
new file mode 100644
index 0000000..c8a606a
--- /dev/null
+++ b/src/output/mod.rs
@@ -0,0 +1,16 @@
+pub mod csv;
+pub mod format;
+pub mod json;
+pub mod table;
+
+use format::OutputFormat;
+use serde_json::Value;
+
+/// Render a value in the specified output format.
+pub fn render(value: &Value, format: OutputFormat) -> anyhow::Result<()> {
+    match format {
+        OutputFormat::Json => json::render(value),
+        OutputFormat::Table => table::render(value),
+        OutputFormat::Csv => csv::render(value),
+    }
+}
diff --git a/src/output/table.rs b/src/output/table.rs
new file mode 100644
index 0000000..f8b4353
--- /dev/null
+++ b/src/output/table.rs
@@ -0,0 +1,96 @@
+use comfy_table::{presets::UTF8_FULL_CONDENSED, ContentArrangement, Table};
+use serde_json::Value;
+
+/// Render a JSON value as a human-readable table.
+pub fn render(value: &Value) -> anyhow::Result<()> {
+    match value {
+        Value::Array(arr) if !arr.is_empty() => render_array(arr),
+        Value::Object(obj) => render_object(obj),
+        Value::String(s) => {
+            println!("{s}");
+            Ok(())
+        }
+        _ => {
+            // Fallback to JSON for non-tabular data
+            super::json::render(value)
+        }
+    }
+}
+
+/// Render an array of objects as a table with column headers.
+fn render_array(arr: &[Value]) -> anyhow::Result<()> {
+    // Collect all unique keys as columns
+    let mut columns: Vec<String> = Vec::new();
+    for item in arr {
+        if let Value::Object(obj) = item {
+            for key in obj.keys() {
+                if !columns.contains(key) {
+                    columns.push(key.clone());
+                }
+            }
+        }
+    }
+
+    if columns.is_empty() {
+        return super::json::render(&Value::Array(arr.to_vec()));
+    }
+
+    let mut table = Table::new();
+    table
+        .load_preset(UTF8_FULL_CONDENSED)
+        .set_content_arrangement(ContentArrangement::Dynamic);
+
+    table.set_header(&columns);
+
+    for item in arr {
+        if let Value::Object(obj) = item {
+            let row: Vec<String> = columns
+                .iter()
+                .map(|col| format_cell(obj.get(col).unwrap_or(&Value::Null)))
+                .collect();
+            table.add_row(row);
+        }
+    }
+
+    println!("{table}");
+    Ok(())
+}
+
+/// Render a single object as a key-value table.
+fn render_object(obj: &serde_json::Map<String, Value>) -> anyhow::Result<()> {
+    let mut table = Table::new();
+    table
+        .load_preset(UTF8_FULL_CONDENSED)
+        .set_content_arrangement(ContentArrangement::Dynamic);
+
+    table.set_header(vec!["Key", "Value"]);
+
+    for (key, value) in obj {
+        table.add_row(vec![key.clone(), format_cell(value)]);
+    }
+
+    println!("{table}");
+    Ok(())
+}
+
+/// Format a JSON value for table cell display.
+fn format_cell(value: &Value) -> String {
+    match value {
+        Value::Null => "".to_string(),
+        Value::String(s) => s.clone(),
+        Value::Number(n) => n.to_string(),
+        Value::Bool(b) => b.to_string(),
+        Value::Array(a) => {
+            if a.len() <= 5 {
+                let items: Vec<String> = a.iter().map(|v| format_cell(v)).collect();
+                items.join(", ")
+            } else {
+                format!("[{} items]", a.len())
+            }
+        }
+        Value::Object(_) => {
+            // Compact JSON for nested objects
+            serde_json::to_string(value).unwrap_or_else(|_| "{...}".to_string())
+        }
+    }
+}
diff --git a/src/parser/fragment_parser.rs b/src/parser/fragment_parser.rs
new file mode 100644
index 0000000..51496b6
--- /dev/null
+++ b/src/parser/fragment_parser.rs
@@ -0,0 +1,319 @@
+use crate::models::profile::*;
+use crate::parser::operator_parser::OperatorInfo;
+use crate::parser::value_parser;
+use once_cell::sync::Lazy;
+use regex::Regex;
+
+static FRAGMENT_RE: Lazy<Regex> = Lazy::new(|| Regex::new(r"Fragment\s+(\d+)\s*:").unwrap());
+
+// Doris 3.0: "Pipeline : 0(instance_num=1):"
+// Doris 4.0: "Pipeline 0(instance_num=1):"
+static PIPELINE_RE: Lazy<Regex> =
+    Lazy::new(|| Regex::new(r"Pipeline\s*:?\s*(\d+)\s*\(instance_num=(\d+)\)\s*:").unwrap());
+
+// Counter line: "- MetricName: avg VALUE, max VALUE, min VALUE"
+// Or: "- MetricName: sum VALUE, avg VALUE, max VALUE, min VALUE"
+static COUNTER_RE: Lazy<Regex> =
+    Lazy::new(|| Regex::new(r"^\s*-\s+(\S[^:]*?)\s*:\s+(.+)$").unwrap());
+
+// PlanInfo block
+static PLAN_INFO_RE: Lazy<Regex> = Lazy::new(|| Regex::new(r"^\s*-\s+PlanInfo\s*$").unwrap());
+
+static PLAN_INFO_ITEM_RE: Lazy<Regex> =
+    Lazy::new(|| Regex::new(r"^\s*-\s+(.+?):\s+(.+)$").unwrap());
+
+/// Parse the MergedProfile section into Fragments.
+pub fn parse_merged_profile(text: &str) -> Vec<Fragment> {
+    let lines: Vec<&str> = text.lines().collect();
+    let mut fragments = Vec::new();
+    let mut i = 0;
+
+    while i < lines.len() {
+        let line = lines[i];
+
+        if let Some(caps) = FRAGMENT_RE.captures(line) {
+            let frag_id: i32 = caps[1].parse().unwrap_or(0);
+            let (fragment, next_i) = parse_fragment(frag_id, &lines, i + 1);
+            fragments.push(fragment);
+            i = next_i;
+        } else {
+            i += 1;
+        }
+    }
+
+    fragments
+}
+
+fn parse_fragment(frag_id: i32, lines: &[&str], start: usize) -> (Fragment, usize) {
+    let mut pipelines = Vec::new();
+    let mut i = start;
+
+    let _frag_indent = get_indent(lines.get(start.saturating_sub(1)).unwrap_or(&""));
+
+    while i < lines.len() {
+        let line = lines[i];
+
+        // Check if we've hit the next fragment
+        if FRAGMENT_RE.is_match(line) {
+            break;
+        }
+
+        if let Some(caps) = PIPELINE_RE.captures(line) {
+            let pipe_id: i32 = caps[1].parse().unwrap_or(0);
+            let instance_num: i32 = caps[2].parse().unwrap_or(1);
+            let (pipeline, next_i) = parse_pipeline(pipe_id, instance_num, lines, i + 1);
+            pipelines.push(pipeline);
+            i = next_i;
+        } else {
+            i += 1;
+        }
+    }
+
+    (
+        Fragment {
+            id: frag_id,
+            pipelines,
+        },
+        i,
+    )
+}
+
+fn parse_pipeline(
+    pipe_id: i32,
+    instance_num: i32,
+    lines: &[&str],
+    start: usize,
+) -> (Pipeline, usize) {
+    let mut operators = Vec::new();
+    let mut i = start;
+
+    while i < lines.len() {
+        let line = lines[i];
+
+        // Stop at next pipeline or fragment
+        if PIPELINE_RE.is_match(line) || FRAGMENT_RE.is_match(line) {
+            break;
+        }
+
+        // Try to parse operator header
+        if let Some(mut op_info) = OperatorInfo::parse(line) {
+            let (operator, next_i) = parse_operator(&mut op_info, lines, i + 1);
+            operators.push(operator);
+            i = next_i;
+        } else {
+            i += 1;
+        }
+    }
+
+    (
+        Pipeline {
+            id: pipe_id,
+            instance_num,
+            operators,
+        },
+        i,
+    )
+}
+
+fn parse_operator(info: &mut OperatorInfo, lines: &[&str], start: usize) -> (Operator, usize) {
+    let mut counters = std::collections::HashMap::new();
+    let mut plan_info = std::collections::HashMap::new();
+    let mut i = start;
+    let mut in_plan_info = false;
+
+    while i < lines.len() {
+        let line = lines[i];
+
+        // Stop if we hit another operator, pipeline, or fragment
+        if OperatorInfo::parse(line).is_some()
+            || PIPELINE_RE.is_match(line)
+            || FRAGMENT_RE.is_match(line)
+        {
+            break;
+        }
+
+        // Check for PlanInfo block
+        if PLAN_INFO_RE.is_match(line) {
+            in_plan_info = true;
+            i += 1;
+            continue;
+        }
+
+        if in_plan_info {
+            // PlanInfo items are indented further
+            if let Some(caps) = PLAN_INFO_ITEM_RE.captures(line) {
+                let key = caps[1].trim().to_string();
+                let value = caps[2].trim().to_string();
+
+                // Check if this is a table reference in a scan operator
+                // Doris format: "TABLE: tpch_demo.orders(orders), PREAGGREGATION: ON"
+                if key == "TABLE" || key == "table" {
+                    let table_val = value
+                        .split(',')
+                        .next()
+                        .unwrap_or(&value)
+                        .split('(')
+                        .next()
+                        .unwrap_or(&value)
+                        .trim()
+                        .to_string();
+                    if !table_val.is_empty() {
+                        info.table_name = Some(table_val);
+                    }
+                }
+
+                plan_info.insert(key, value);
+            } else if line.trim().starts_with('-') && COUNTER_RE.is_match(line) {
+                // We've exited PlanInfo and hit counters
+                in_plan_info = false;
+            } else {
+                // Still in PlanInfo — might be a continuation
+                i += 1;
+                continue;
+            }
+        }
+
+        if !in_plan_info {
+            let trimmed = line.trim();
+            // Skip Doris 4.0 subsection headers
+            if trimmed == "CommonCounters:" || trimmed == "CustomCounters:" {
+                i += 1;
+                continue;
+            }
+
+            if let Some(caps) = COUNTER_RE.captures(line) {
+                let name = caps[1].trim().to_string();
+                let value_str = caps[2].trim().to_string();
+
+                if let Some(agg) = parse_agg_value(&value_str) {
+                    counters.insert(name, agg);
+                }
+            }
+        }
+
+        i += 1;
+    }
+
+    // Build OperatorMetrics from known counters
+    let metrics = OperatorMetrics {
+        exec_time: counters.get("ExecTime").cloned(),
+        input_rows: counters.get("InputRows").cloned(),
+        rows_produced: counters.get("RowsProduced").cloned(),
+        memory_usage: counters.get("MemoryUsage").cloned(),
+        memory_usage_peak: counters.get("MemoryUsagePeak").cloned(),
+        open_time: counters.get("OpenTime").cloned(),
+        close_time: counters.get("CloseTime").cloned(),
+        init_time: counters.get("InitTime").cloned(),
+        wait_for_dependency_time: counters.get("WaitForDependencyTime").cloned(),
+    };
+
+    let op = Operator {
+        info: crate::models::profile::OperatorInfoModel {
+            full_name: info.full_name.clone(),
+            operator_type: info.operator_type.clone(),
+            id: info.id,
+            nereids_id: info.nereids_id,
+            table_name: info.table_name.clone(),
+            dest_id: info.dest_id,
+            is_sink: info.is_sink,
+        },
+        metrics,
+        all_counters: counters,
+        plan_info,
+    };
+
+    (op, i)
+}
+
+/// Parse an aggregated value string like "avg 150.364us, max 150.364us, min 150.364us"
+/// or "sum 24, avg 24, max 24, min 24"
+fn parse_agg_value(s: &str) -> Option<AggValue> {
+    let s = s.trim();
+    if s.is_empty() {
+        return None;
+    }
+
+    let mut sum = None;
+    let mut avg = None;
+    let mut max = None;
+    let mut min = None;
+
+    // Split by comma and parse each part
+    for part in s.split(',') {
+        let part = part.trim();
+        if let Some(val_str) = part
+            .strip_prefix("sum ")
+            .or_else(|| part.strip_prefix("sum\t"))
+        {
+            sum = Some(value_parser::parse_counter_value(val_str));
+        } else if let Some(val_str) = part
+            .strip_prefix("avg ")
+            .or_else(|| part.strip_prefix("avg\t"))
+        {
+            avg = Some(value_parser::parse_counter_value(val_str));
+        } else if let Some(val_str) = part
+            .strip_prefix("max ")
+            .or_else(|| part.strip_prefix("max\t"))
+        {
+            max = Some(value_parser::parse_counter_value(val_str));
+        } else if let Some(val_str) = part
+            .strip_prefix("min ")
+            .or_else(|| part.strip_prefix("min\t"))
+        {
+            min = Some(value_parser::parse_counter_value(val_str));
+        } else {
+            // Single value (no prefix) — treat as all fields
+            let v = value_parser::parse_counter_value(part);
+            if v != 0.0 || part == "0" || part == "0ns" || part.starts_with("0.") {
+                return Some(AggValue {
+                    sum: Some(v),
+                    avg: Some(v),
+                    max: Some(v),
+                    min: Some(v),
+                    raw: Some(s.to_string()),
+                });
+            }
+        }
+    }
+
+    if avg.is_some() || sum.is_some() || max.is_some() || min.is_some() {
+        Some(AggValue {
+            sum,
+            avg,
+            max,
+            min,
+            raw: Some(s.to_string()),
+        })
+    } else {
+        None
+    }
+}
+
+fn get_indent(line: &str) -> usize {
+    line.len() - line.trim_start().len()
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn test_parse_agg_value_time() {
+        let agg = parse_agg_value("avg 150.364us, max 150.364us, min 150.364us").unwrap();
+        assert!((agg.avg.unwrap() - 0.150364).abs() < 0.001);
+    }
+
+    #[test]
+    fn test_parse_agg_value_with_sum() {
+        let agg = parse_agg_value("sum 24, avg 24, max 24, min 24").unwrap();
+        assert!((agg.sum.unwrap() - 24.0).abs() < 0.001);
+        assert!((agg.avg.unwrap() - 24.0).abs() < 0.001);
+    }
+
+    #[test]
+    fn test_parse_agg_value_bytes() {
+        let agg =
+            parse_agg_value("sum 57.94 KB, avg 57.94 KB, max 57.94 KB, min 57.94 KB").unwrap();
+        assert!(agg.sum.unwrap() > 50000.0);
+    }
+}
diff --git a/src/parser/mod.rs b/src/parser/mod.rs
new file mode 100644
index 0000000..ecb8672
--- /dev/null
+++ b/src/parser/mod.rs
@@ -0,0 +1,5 @@
+pub mod fragment_parser;
+pub mod operator_parser;
+pub mod profile_parser;
+pub mod section_parser;
+pub mod value_parser;
diff --git a/src/parser/operator_parser.rs b/src/parser/operator_parser.rs
new file mode 100644
index 0000000..4ca01bb
--- /dev/null
+++ b/src/parser/operator_parser.rs
@@ -0,0 +1,105 @@
+use once_cell::sync::Lazy;
+use regex::Regex;
+
+/// Parsed operator info from the operator header line.
+#[derive(Debug, Clone)]
+pub struct OperatorInfo {
+    pub full_name: String,
+    pub operator_type: String,
+    pub id: i32,
+    pub nereids_id: Option<i32>,
+    pub table_name: Option<String>,
+    pub dest_id: Option<i32>,
+    pub is_sink: bool,
+}
+
+// Match any operator line containing (id=N):
+// Captures: 1=everything before (id=, 2=id, 3=nereids_id, 4=dst_id
+static OPERATOR_RE: Lazy<Regex> = Lazy::new(|| {
+    Regex::new(r"(.+?)\(?id=(-?\d+)(?:\s*,?\s*nereids_id=(\d+))?(?:\s*,?\s*dst_id=(\d+))?\)\s*:")
+        .unwrap()
+});
+
+// Extract table_name from Doris 4.0 operator header:
+// "OLAP_SCAN_OPERATOR(nereids_id=556. table_name=orders(orders))(id=2):"
+static TABLE_NAME_RE: Lazy<Regex> = Lazy::new(|| Regex::new(r"table_name=(\w+)").unwrap());
+
+impl OperatorInfo {
+    /// Parse an operator header line.
+    pub fn parse(line: &str) -> Option<Self> {
+        let caps = OPERATOR_RE.captures(line)?;
+
+        let full_name = caps[1].trim().to_string();
+        let id: i32 = caps[2].parse().ok()?;
+        let nereids_id: Option<i32> = caps.get(3).and_then(|m| m.as_str().parse().ok());
+        let dest_id: Option<i32> = caps.get(4).and_then(|m| m.as_str().parse().ok());
+
+        // Extract the base operator type (without parenthesized qualifiers)
+        let operator_type = full_name
+            .split('(')
+            .next()
+            .unwrap_or(&full_name)
+            .trim()
+            .to_string();
+
+        let is_sink = operator_type.contains("SINK");
+
+        // Extract table_name from Doris 4.0 header format
+        let table_name = TABLE_NAME_RE.captures(line).map(|c| c[1].to_string());
+
+        Some(OperatorInfo {
+            full_name,
+            operator_type,
+            id,
+            nereids_id,
+            table_name,
+            dest_id,
+            is_sink,
+        })
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn test_parse_simple() {
+        let info = OperatorInfo::parse("RESULT_SINK_OPERATOR (id=0):").unwrap();
+        assert_eq!(info.operator_type, "RESULT_SINK_OPERATOR");
+        assert_eq!(info.id, 0);
+        assert!(info.is_sink);
+    }
+
+    #[test]
+    fn test_parse_with_nereids() {
+        let info = OperatorInfo::parse("SORT_OPERATOR (id=13 , nereids_id=1617):").unwrap();
+        assert_eq!(info.id, 13);
+        assert_eq!(info.nereids_id, Some(1617));
+    }
+
+    #[test]
+    fn test_parse_with_local_exchange() {
+        let info =
+            OperatorInfo::parse("LOCAL_EXCHANGE_OPERATOR (LOCAL_MERGE_SORT) (id=-4):").unwrap();
+        assert_eq!(info.id, -4);
+        assert!(info.full_name.contains("LOCAL_MERGE_SORT"));
+    }
+
+    #[test]
+    fn test_parse_dst_id() {
+        let info = OperatorInfo::parse("DATA_STREAM_SINK_OPERATOR (id=14,dst_id=14):").unwrap();
+        assert_eq!(info.dest_id, Some(14));
+    }
+
+    #[test]
+    fn test_parse_doris4_scan_with_table() {
+        let info = OperatorInfo::parse(
+            "OLAP_SCAN_OPERATOR(nereids_id=556. table_name=orders(orders))(id=2):",
+        )
+        .unwrap();
+        assert_eq!(info.id, 2);
+        assert_eq!(info.table_name, Some("orders".to_string()));
+        assert!(info.operator_type.contains("OLAP_SCAN"));
+    }
+}
diff --git a/src/parser/profile_parser.rs b/src/parser/profile_parser.rs
new file mode 100644
index 0000000..0a5f2dc
--- /dev/null
+++ b/src/parser/profile_parser.rs
@@ -0,0 +1,308 @@
+use crate::models::profile::*;
+use crate::parser::{fragment_parser, section_parser, value_parser};
+
+/// Parse a raw Doris profile text into a structured DorisProfile.
+pub fn parse(raw_text: &str) -> DorisProfile {
+    let normalized = section_parser::normalize_text(raw_text);
+    let sections = section_parser::split_sections(&normalized);
+
+    // Parse Summary
+    let summary_text = sections.get("Summary").map(|s| s.as_str()).unwrap_or("");
+    let summary_kv = section_parser::parse_kv_section(summary_text);
+    let total_time_str = summary_kv.get("Total").cloned().unwrap_or_default();
+    let total_time_ms = value_parser::parse_duration_ms(&total_time_str);
+
+    let summary = ProfileSummary {
+        query_id: summary_kv.get("Profile ID").cloned().unwrap_or_default(),
+        total_time: total_time_str,
+        total_time_ms,
+        state: summary_kv.get("Task State").cloned().unwrap_or_default(),
+        sql: summary_kv.get("Sql Statement").cloned().unwrap_or_default(),
+        doris_version: summary_kv.get("Doris Version").cloned(),
+        is_nereids: summary_kv.get("Is Nereids").map(|v| v == "Yes"),
+        is_cached: summary_kv.get("Is Cached").map(|v| v == "Yes"),
+        total_instances: summary_kv
+            .get("Total Instances Num")
+            .and_then(|v| v.parse().ok()),
+        user: summary_kv.get("User").cloned(),
+        start_time: summary_kv.get("Start Time").cloned(),
+        end_time: summary_kv.get("End Time").cloned(),
+        default_db: summary_kv.get("Default Db").cloned(),
+    };
+
+    // Parse Execution Summary
+    let exec_text = sections
+        .get("Execution Summary")
+        .map(|s| s.as_str())
+        .unwrap_or("");
+    let exec_kv = section_parser::parse_kv_section(exec_text);
+
+    let execution_summary = ExecutionSummary {
+        parse_sql_time: exec_kv.get("Parse SQL Time").cloned(),
+        plan_time: exec_kv.get("Plan Time").cloned(),
+        schedule_time: exec_kv.get("Schedule Time").cloned(),
+        wait_fetch_result_time: exec_kv.get("Wait and Fetch Result Time").cloned(),
+        fetch_result_time: exec_kv.get("Fetch Result Time").cloned(),
+        write_result_time: exec_kv.get("Write Result Time").cloned(),
+        nereids_analysis_time: exec_kv.get("Nereids Analysis Time").cloned(),
+        nereids_rewrite_time: exec_kv.get("Nereids Rewrite Time").cloned(),
+        nereids_optimize_time: exec_kv.get("Nereids Optimize Time").cloned(),
+        workload_group: exec_kv.get("Workload Group").cloned(),
+    };
+
+    // Parse Changed Session Variables
+    let vars_text = sections
+        .get("Changed Session Variables")
+        .map(|s| s.as_str())
+        .unwrap_or("");
+    let changed_session_vars = parse_session_vars(vars_text);
+
+    // Parse MergedProfile
+    let merged_text = sections
+        .get("MergedProfile")
+        .map(|s| s.as_str())
+        .unwrap_or("");
+    let fragments = fragment_parser::parse_merged_profile(merged_text);
+
+    DorisProfile {
+        summary,
+        execution_summary,
+        changed_session_vars,
+        fragments,
+    }
+}
+
+fn parse_session_vars(text: &str) -> Vec<SessionVar> {
+    let mut vars = Vec::new();
+    for line in text.lines() {
+        let line = line.trim();
+        // Skip header and separator lines
+        if line.is_empty()
+            || line.starts_with("VarName")
+            || line.starts_with("---")
+            || line.starts_with('-')
+        {
+            continue;
+        }
+
+        let parts: Vec<&str> = line.split('|').map(|s| s.trim()).collect();
+        if parts.len() >= 3 {
+            vars.push(SessionVar {
+                name: parts[0].to_string(),
+                current_value: parts[1].to_string(),
+                default_value: parts[2].to_string(),
+            });
+        }
+    }
+    vars
+}
+
+/// Extract all operators from a parsed profile, flattened.
+pub fn flatten_operators(profile: &DorisProfile) -> Vec<FlatOperator> {
+    let total_time_ms = profile.summary.total_time_ms.unwrap_or(1.0).max(0.001);
+    let mut result = Vec::new();
+
+    for fragment in &profile.fragments {
+        for pipeline in &fragment.pipelines {
+            for op in &pipeline.operators {
+                let exec_time_avg_ms = op
+                    .metrics
+                    .exec_time
+                    .as_ref()
+                    .and_then(|v| v.avg)
+                    .unwrap_or(0.0);
+
+                let input_rows = op.metrics.input_rows.as_ref().and_then(|v| v.sum.or(v.avg));
+
+                let output_rows = op
+                    .metrics
+                    .rows_produced
+                    .as_ref()
+                    .and_then(|v| v.sum.or(v.avg));
+
+                let skew_ratio = op.metrics.exec_time.as_ref().and_then(|v| v.skew_ratio());
+
+                let time_pct = (exec_time_avg_ms / total_time_ms) * 100.0;
+
+                // Selectivity: input / output ratio
+                let selectivity = match (input_rows, output_rows) {
+                    (Some(inp), Some(out)) if out > 0.0 => Some(round2(inp / out)),
+                    _ => None,
+                };
+
+                // Spill detection
+                let spill_write = op
+                    .all_counters
+                    .get("SpillWriteBytes")
+                    .or_else(|| op.all_counters.get("SpillWriteBytesToLocalStorage"))
+                    .and_then(|v| v.sum.or(v.avg))
+                    .unwrap_or(0.0);
+                let spilled = if spill_write > 0.0 { Some(true) } else { None };
+
+                // Peak memory
+                let peak_mem_bytes = op
+                    .metrics
+                    .memory_usage_peak
+                    .as_ref()
+                    .and_then(|v| v.sum.or(v.avg))
+                    .filter(|&v| v > 0.0);
+
+                // Wait dependency analysis: blocked if wait_time > exec_time * 2
+                let wait_time_ms = op
+                    .metrics
+                    .wait_for_dependency_time
+                    .as_ref()
+                    .and_then(|v| v.avg)
+                    .filter(|&v| v > 0.0);
+
+                let blocked_on_upstream = match (wait_time_ms, exec_time_avg_ms) {
+                    (Some(wait), exec) if exec > 0.0 && wait > exec * 2.0 => Some(true),
+                    _ => None,
+                };
+
+                // Runtime filter extraction from plan_info AND all_counters
+                let mut runtime_filters: Vec<String> = Vec::new();
+
+                // From plan_info: keys containing RF references
+                for (k, v) in &op.plan_info {
+                    if k.contains("RF") || k.contains("runtime") || k.contains("RuntimeFilter") {
+                        runtime_filters.push(format!("{k}: {v}"));
+                    }
+                }
+
+                // From all_counters: RuntimeFilter-related counters
+                for (k, v) in &op.all_counters {
+                    if k.contains("RuntimeFilter") || k.starts_with("RF") {
+                        let val = v.avg.or(v.sum).unwrap_or(0.0);
+                        if val > 0.0 {
+                            runtime_filters.push(format!("{k}: {val}"));
+                        }
+                    }
+                }
+
+                // From all_counters: check for runtime filter specific metrics
+                let rf_input = op
+                    .all_counters
+                    .get("RuntimeFilterInput")
+                    .or_else(|| op.all_counters.get("RuntimeFilterNum"))
+                    .and_then(|v| v.sum.or(v.avg));
+                if let Some(rf_count) = rf_input {
+                    if rf_count > 0.0
+                        && !runtime_filters.iter().any(|r| r.contains("RuntimeFilter"))
+                    {
+                        runtime_filters.push(format!("RuntimeFiltersApplied: {rf_count}"));
+                    }
+                }
+
+                let runtime_filters = if runtime_filters.is_empty() {
+                    None
+                } else {
+                    Some(runtime_filters)
+                };
+
+                // Shuffle bytes (for exchange/data_stream operators)
+                let shuffle_bytes = op
+                    .all_counters
+                    .get("ShuffleSendBytes")
+                    .or_else(|| op.all_counters.get("BytesSent"))
+                    .or_else(|| op.all_counters.get("OverallThroughput"))
+                    .and_then(|v| v.sum.or(v.avg))
+                    .filter(|&v| v > 0.0);
+
+                // Cache hit percentage (for scan operators)
+                let cache_hit_pct = {
+                    let hit = op
+                        .all_counters
+                        .get("FileCacheHitBytes")
+                        .or_else(|| op.all_counters.get("CacheHitBytes"))
+                        .and_then(|v| v.sum.or(v.avg))
+                        .unwrap_or(0.0);
+                    let miss = op
+                        .all_counters
+                        .get("FileCacheMissBytes")
+                        .or_else(|| op.all_counters.get("CacheMissBytes"))
+                        .and_then(|v| v.sum.or(v.avg))
+                        .unwrap_or(0.0);
+                    let total = hit + miss;
+                    if total > 0.0 {
+                        Some(round2((hit / total) * 100.0))
+                    } else {
+                        None
+                    }
+                };
+
+                // Rows filtered (scan: output < input means filtering happened)
+                let rows_filtered = match (input_rows, output_rows) {
+                    (Some(inp), Some(out)) if inp > out && inp > 0.0 => Some(inp - out),
+                    _ => None,
+                };
+
+                // Join type from PlanInfo
+                let join_type = op
+                    .plan_info
+                    .iter()
+                    .find_map(|(k, v)| {
+                        let combined = format!("{k} {v}").to_lowercase();
+                        if combined.contains("broadcast") {
+                            Some("broadcast".to_string())
+                        } else if combined.contains("bucket_shuffle")
+                            || combined.contains("bucketshuffle")
+                        {
+                            Some("bucket_shuffle".to_string())
+                        } else if combined.contains("colocate") {
+                            Some("colocated".to_string())
+                        } else if combined.contains("shuffle") || combined.contains("hash") {
+                            Some("shuffle".to_string())
+                        } else {
+                            None
+                        }
+                    })
+                    // Also try extracting from operator name
+                    .or_else(|| {
+                        let name_lower = op.info.full_name.to_lowercase();
+                        if name_lower.contains("broadcast") {
+                            Some("broadcast".to_string())
+                        } else if name_lower.contains("colocate") {
+                            Some("colocated".to_string())
+                        } else {
+                            None
+                        }
+                    });
+
+                result.push(FlatOperator {
+                    name: op.info.full_name.clone(),
+                    table: op.info.table_name.clone(),
+                    frag: fragment.id,
+                    pipeline: pipeline.id,
+                    exec_time_avg_ms: round2(exec_time_avg_ms),
+                    input_rows,
+                    output_rows,
+                    skew_ratio: skew_ratio.map(round2),
+                    time_pct: round2(time_pct),
+                    selectivity,
+                    spilled,
+                    peak_mem_bytes,
+                    blocked_on_upstream,
+                    wait_time_ms: wait_time_ms.map(round2),
+                    runtime_filters,
+                    shuffle_bytes,
+                    cache_hit_pct,
+                    rows_filtered,
+                    join_type,
+                });
+            }
+        }
+    }
+
+    // Sort by exec_time descending
+    result.sort_by(|a, b| {
+        b.exec_time_avg_ms
+            .partial_cmp(&a.exec_time_avg_ms)
+            .unwrap_or(std::cmp::Ordering::Equal)
+    });
+    result
+}
+
+fn round2(v: f64) -> f64 {
+    (v * 100.0).round() / 100.0
+}
diff --git a/src/parser/section_parser.rs b/src/parser/section_parser.rs
new file mode 100644
index 0000000..d76e0ee
--- /dev/null
+++ b/src/parser/section_parser.rs
@@ -0,0 +1,98 @@
+use once_cell::sync::Lazy;
+use regex::Regex;
+use std::collections::HashMap;
+
+/// Collapse double-spaced text from Doris 3.0 web export.
+/// "Profile  ID" → "Profile ID", but preserve indentation.
+pub fn normalize_text(input: &str) -> String {
+    let mut result = String::with_capacity(input.len());
+
+    for line in input.lines() {
+        // Preserve leading whitespace
+        let trimmed = line.trim_end();
+        let leading = &trimmed[..trimmed.len() - trimmed.trim_start().len()];
+        let content = trimmed.trim_start();
+
+        // Collapse runs of 2+ spaces within the content (not leading indent)
+        static MULTI_SPACE: Lazy<Regex> = Lazy::new(|| Regex::new(r"  +").unwrap());
+        let normalized = MULTI_SPACE.replace_all(content, " ");
+
+        result.push_str(leading);
+        result.push_str(&normalized);
+        result.push('\n');
+    }
+
+    // Also remove \r
+    result.replace('\r', "")
+}
+
+/// Split a normalized profile text into named sections.
+pub fn split_sections(text: &str) -> HashMap<String, String> {
+    static SECTION_RE: Lazy<Regex> = Lazy::new(|| {
+        Regex::new(
+            r"(?m)^\s*(Summary|Execution Summary|Changed Session Variables|Physical Plan|MergedProfile)\s*:?\s*$",
+        )
+        .unwrap()
+    });
+
+    let mut sections = HashMap::new();
+    let mut current_name: Option<String> = None;
+    let mut current_content = String::new();
+
+    for line in text.lines() {
+        if let Some(caps) = SECTION_RE.captures(line) {
+            // Save previous section
+            if let Some(name) = current_name.take() {
+                sections.insert(name, current_content.trim().to_string());
+                current_content.clear();
+            }
+            current_name = Some(caps[1].to_string());
+        } else if current_name.is_some() {
+            current_content.push_str(line);
+            current_content.push('\n');
+        }
+    }
+
+    // Save last section
+    if let Some(name) = current_name {
+        sections.insert(name, current_content.trim().to_string());
+    }
+
+    sections
+}
+
+/// Parse key-value pairs from Summary or Execution Summary sections.
+/// Lines look like: "      - Key: Value"
+pub fn parse_kv_section(text: &str) -> HashMap<String, String> {
+    static KV_RE: Lazy<Regex> = Lazy::new(|| Regex::new(r"^\s*-\s+(.+?):\s+(.+)$").unwrap());
+
+    let mut map = HashMap::new();
+    for line in text.lines() {
+        if let Some(caps) = KV_RE.captures(line) {
+            let key = caps[1].trim().to_string();
+            let value = caps[2].trim().to_string();
+            map.insert(key, value);
+        }
+    }
+    map
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn test_normalize_double_spaces() {
+        let result = normalize_text("      -  Profile  ID:  abc123");
+        // Leading indent is preserved, double spaces in content collapsed
+        assert!(result.contains("- Profile ID: abc123"));
+    }
+
+    #[test]
+    fn test_parse_kv() {
+        let text = "      - Total: 32sec281ms\n      - Task State: OK\n";
+        let kv = parse_kv_section(text);
+        assert_eq!(kv.get("Total"), Some(&"32sec281ms".to_string()));
+        assert_eq!(kv.get("Task State"), Some(&"OK".to_string()));
+    }
+}
diff --git a/src/parser/value_parser.rs b/src/parser/value_parser.rs
new file mode 100644
index 0000000..d5125eb
--- /dev/null
+++ b/src/parser/value_parser.rs
@@ -0,0 +1,151 @@
+use once_cell::sync::Lazy;
+use regex::Regex;
+
+static TIME_COMPONENT_RE: Lazy<Regex> =
+    Lazy::new(|| Regex::new(r"(\d+(?:\.\d+)?)\s*(ms|us|μs|ns|h|m(?:in)?|s(?:ec)?)").unwrap());
+
+static BYTES_RE: Lazy<Regex> = Lazy::new(|| Regex::new(r"^([\d,.]+)\s*(TB|GB|MB|KB|B)?").unwrap());
+
+/// Parse a Doris duration string to milliseconds.
+/// Examples: "32sec281ms", "150.364us", "0ns", "1h2m3sec", "442.308ms"
+pub fn parse_duration_ms(input: &str) -> Option<f64> {
+    let input = input.trim();
+
+    if input == "0" || input == "N/A" {
+        return Some(0.0);
+    }
+
+    let mut total_ns: f64 = 0.0;
+    let mut found = false;
+
+    for cap in TIME_COMPONENT_RE.captures_iter(input) {
+        found = true;
+        let num: f64 = cap[1].parse().ok()?;
+        let unit = &cap[2];
+
+        let ns = match unit {
+            "h" => num * 3600.0 * 1e9,
+            "m" | "min" => num * 60.0 * 1e9,
+            "s" | "sec" => num * 1e9,
+            "ms" => num * 1e6,
+            "us" | "μs" => num * 1e3,
+            "ns" => num,
+            _ => 0.0,
+        };
+        total_ns += ns;
+    }
+
+    if found {
+        Some(total_ns / 1e6) // Convert ns to ms
+    } else {
+        None
+    }
+}
+
+/// Parse a bytes string like "57.94 KB", "8.62 MB", "0.00 " to bytes.
+pub fn parse_bytes(input: &str) -> Option<f64> {
+    let input = input.trim();
+    if input.is_empty() || input == "0" || input == "0.00" {
+        return Some(0.0);
+    }
+
+    if let Some(caps) = BYTES_RE.captures(input) {
+        let num_str = caps[1].replace(',', "");
+        let num: f64 = num_str.parse().ok()?;
+        let unit = caps.get(2).map(|m| m.as_str()).unwrap_or("B");
+        let bytes = match unit {
+            "TB" => num * 1024.0 * 1024.0 * 1024.0 * 1024.0,
+            "GB" => num * 1024.0 * 1024.0 * 1024.0,
+            "MB" => num * 1024.0 * 1024.0,
+            "KB" => num * 1024.0,
+            _ => num,
+        };
+        Some(bytes)
+    } else {
+        None
+    }
+}
+
+/// Parse a number string, handling commas: "3,301,515,299" → 3301515299.0
+pub fn parse_number(input: &str) -> Option<f64> {
+    let cleaned = input.trim().replace(',', "");
+    cleaned.parse::<f64>().ok()
+}
+
+/// Parse a counter value — could be duration, bytes, or plain number.
+/// Doris profile format: "3.301515299B (3301515299)" — parenthetical is the exact value.
+/// Returns the numeric value (ms for time, bytes for size, raw for counts).
+pub fn parse_counter_value(input: &str) -> f64 {
+    let input = input.trim();
+
+    // First: extract parenthetical value if present (highest precision)
+    // e.g., "3.301515299B (3301515299)" → use 3301515299
+    if let Some(start) = input.find('(') {
+        if let Some(end) = input.find(')') {
+            let paren_val = input[start + 1..end].trim();
+            if let Ok(n) = paren_val.parse::<f64>() {
+                return n;
+            }
+        }
+    }
+
+    // Try duration first
+    if let Some(ms) = parse_duration_ms(input) {
+        return ms;
+    }
+
+    // Try bytes
+    if let Some(bytes) = parse_bytes(input) {
+        return bytes;
+    }
+
+    // Try plain number
+    if let Some(n) = parse_number(input) {
+        return n;
+    }
+
+    0.0
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn test_parse_duration() {
+        assert!((parse_duration_ms("32sec281ms").unwrap() - 32281.0).abs() < 0.1);
+        assert!((parse_duration_ms("150.364us").unwrap() - 0.150364).abs() < 0.001);
+        assert!((parse_duration_ms("0ns").unwrap() - 0.0).abs() < 0.001);
+        assert!((parse_duration_ms("442.308ms").unwrap() - 442.308).abs() < 0.001);
+        assert!((parse_duration_ms("9sec169ms").unwrap() - 9169.0).abs() < 0.1);
+        assert!((parse_duration_ms("1ms").unwrap() - 1.0).abs() < 0.001);
+    }
+
+    #[test]
+    fn test_parse_bytes() {
+        assert!((parse_bytes("57.94 KB").unwrap() - 59330.56).abs() < 1.0);
+        let mb_val = parse_bytes("8.62 MB").unwrap();
+        assert!(
+            mb_val > 9_000_000.0 && mb_val < 10_000_000.0,
+            "Got {mb_val}"
+        );
+        assert!((parse_bytes("0.00 ").unwrap() - 0.0).abs() < 0.001);
+    }
+
+    #[test]
+    fn test_parse_number() {
+        assert!((parse_number("3,301,515,299").unwrap() - 3301515299.0).abs() < 1.0);
+        assert!((parse_number("24").unwrap() - 24.0).abs() < 0.001);
+    }
+
+    #[test]
+    fn test_parse_counter_value_parenthetical() {
+        // Doris format: "3.301515299B (3301515299)" — should extract 3301515299
+        assert!((parse_counter_value("3.301515299B (3301515299)") - 3301515299.0).abs() < 1.0);
+        assert!((parse_counter_value("22.927189M (22927189)") - 22927189.0).abs() < 1.0);
+        // Without parens — should still work via duration/bytes/number parsing
+        assert!((parse_counter_value("150.364us") - 0.150364).abs() < 0.001);
+        assert!((parse_counter_value("57.94 KB") - 59330.56).abs() < 1.0);
+        assert!((parse_counter_value("24") - 24.0).abs() < 0.001);
+    }
+}
diff --git a/src/product.rs b/src/product.rs
new file mode 100644
index 0000000..f0dc0c7
--- /dev/null
+++ b/src/product.rs
@@ -0,0 +1,34 @@
+use once_cell::sync::Lazy;
+use serde::Deserialize;
+use std::collections::BTreeMap;
+
+#[derive(Debug, Deserialize)]
+struct ProductCatalog {
+    products: BTreeMap<String, ProductProfile>,
+}
+
+#[derive(Debug, Deserialize)]
+pub struct ProductProfile {
+    pub binary: String,
+    pub about: String,
+    pub config_dir: String,
+    pub env_prefix: String,
+}
+
+impl ProductProfile {
+    pub fn env_key(&self, suffix: &str) -> String {
+        format!("{}_{}", self.env_prefix, suffix)
+    }
+}
+
+static PRODUCT_CATALOG: Lazy<ProductCatalog> = Lazy::new(|| {
+    toml::from_str(include_str!("../config/products.toml"))
+        .expect("config/products.toml must be valid")
+});
+
+pub fn get_product(id: &str) -> &'static ProductProfile {
+    PRODUCT_CATALOG
+        .products
+        .get(id)
+        .unwrap_or_else(|| panic!("unknown product profile '{id}'"))
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org