refactor(config): preserve explicit flags with FlagsPatch and derive CLI arguments from schema (#2585)

This PR refactors EasyTier's configuration flags system across protobuf definitions, TOML/API persistence, runtime reconciliation, and the CLI.

It introduces a synthesized FlagsPatch protobuf message with optionize and pbjson support to track field presence reliably, replaces manual CLI flag boilerplate with dynamic schema-driven clap argument generation, and
establishes Flags::resolve(patch) as the single source of truth for runtime defaults.

Co-authored-by: Claude Code <noreply@anthropic.com>
This commit is contained in:
Luna YaoandClaude Code authored and GitHub committed 2026-10-10 22:11:08 +08:00
1 parent 018750a785
commit 250c2ad8d6
52 files changed
+1909 -1405

No files matched your search

Generated
+42 -1
View File
@@ -2572,6 +2572,7 @@ dependencies = [
"pin-project-lite",
"pnet_datalink",
"prost 0.14.4",
"prost-types 0.14.4",
"quanta",
"quinn",
"quinn-proto",
@@ -2669,6 +2670,7 @@ dependencies = [
"hyper-util",
"idna",
"openssl",
"optionize",
"ordered_hash_map",
"parking_lot",
"percent-encoding",
@@ -2676,6 +2678,7 @@ dependencies = [
"pin-project-lite",
"prefix-trie 0.10.1",
"prost 0.14.4",
"prost-reflect 0.16.5",
"prost-types 0.14.4",
"quanta",
"rand 0.8.8",
@@ -2794,7 +2797,7 @@ dependencies = [
"flate2",
"gethostname",
"once_cell",
"prost-reflect",
"prost-reflect 0.14.7",
"rusqlite",
"serde",
"serde_json",
@@ -2842,11 +2845,13 @@ dependencies = [
"cidr",
"hmac 0.12.1",
"indoc",
"optionize",
"pbjson",
"pbjson-build",
"proc-macro2",
"prost 0.14.4",
"prost-build",
"prost-reflect 0.16.5",
"prost-types 0.14.4",
"prost-wkt-types",
"quote",
@@ -2854,6 +2859,7 @@ dependencies = [
"serde",
"serde_json",
"sha2 0.10.9",
"strum 0.28.0",
"thiserror 2.0.20",
"tokio",
"url",
@@ -2917,6 +2923,7 @@ dependencies = [
"mimalloc",
"oauth2-reqwest",
"openidconnect",
"optionize",
"password-auth",
"prost 0.14.4",
"rand 0.8.8",
@@ -6384,6 +6391,30 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]]
name = "optionize"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b6a0111dde86433acde952fdb2757eb65a79ae0e3e58acf378544280d9c3104"
dependencies = [
"derive_more",
"optionize-macros",
]
[[package]]
name = "optionize-macros"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92f30b98a08383cf48fd3d5cc3e3dd27b4a537d94e8488aadff7f3625288b360"
dependencies = [
"darling 0.24.1",
"derive_more",
"proc-macro-crate 3.5.0",
"proc-macro2",
"quote",
"syn 3.0.6",
]
[[package]]
name = "ordered-float"
version = "2.10.1"
@@ -7248,6 +7279,16 @@ dependencies = [
"prost-types 0.13.5",
]
[[package]]
name = "prost-reflect"
version = "0.16.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01b80ea363c31af2de2b92e3c07ed1156628f7838c4afb4df75ee78a37fedbd1"
dependencies = [
"prost 0.14.4",
"prost-types 0.14.4",
]
[[package]]
name = "prost-reflect-derive"
version = "0.14.0"