1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//! Voice package configuration loading for `ReviewConfig`.
//!
//! Why: extracted from `config/mod.rs` to keep that file under the 500-line
//! cap (#610) after adding voice support (#754/#756).
//! What: `VoiceFileConfig` (the TOML `[voice]` table) and the two loading
//! helpers (`load_voice_package`, `load_voice_principles`).
//! Test: `voice_package_from_env`, `voice_principles_defaults_to_true`,
//! `voice_principles_env_disable` in config/config_tests.rs.
use Deserialize;
/// `[voice]` section of the TOML config file.
///
/// Why: voice package selection is opt-in; storing it in the config file lets
/// teams configure a shared voice without setting env vars on every machine.
/// What: `package` names the voice to load (e.g. `"duetto"`); `principles`
/// toggles the universal principles layer (defaults to `true`).
/// Test: covered indirectly by `ReviewConfig::from_env_and_file`.
/// Resolve the voice package name from env var or config file.
///
/// Why: `TRUSTY_REVIEW_VOICE_PACKAGE` env var wins over the config file
/// `[voice] package` key, following the precedence used by all other fields.
/// What: returns `Some(name)` when either source specifies a non-empty name;
/// `None` when both are absent or empty (no voice package selected).
/// Test: `voice_package_from_env`, `voice_package_from_config_file`.
/// Resolve whether the principles layer is enabled from env var or config file.
///
/// Why: `TRUSTY_REVIEW_PRINCIPLES=false` lets operators opt out of the
/// principles layer; defaults to `true` per issue #756 (universal/safe).
/// What: env var overrides config file; both override the default `true`.
/// Test: `voice_principles_defaults_to_true`, `voice_principles_env_disable`.