Skip to main content

whycodes_config/
lib.rs

1//! WhyCodes configuration: load, merge, validate.
2//!
3//! Leaf types (`Message`, `Tool`, sandbox policy) live in `whycodes-core`.
4//! This crate owns the user-facing `Config` tree and I/O.
5
6pub mod dotted;
7mod edit;
8mod load;
9mod merge;
10mod patch;
11mod stream_rules;
12mod types;
13mod validate;
14
15// Re-export leaf sandbox types so callers that already import `whycodes_config`
16// can resolve sandbox policy without a second crate path.
17pub use whycodes_core::sandbox::{SandboxFallback, SandboxMode, SandboxSettings};
18
19pub use types::{
20    AutomationConfig, BashConfig, CONFIG_SCHEMA_VERSION, CommandConfig, Config,
21    CustomCommandConfig, CustomToolConfig, DEFAULT_MODEL_ID, DEFAULT_PROVIDER, FormatConfig,
22    GeneralConfig, HeadlessAskMode, HookConfig, HookEvent, LspConfig, LspServerConfig,
23    MagicKeywordsConfig, McpServerConfig, McpTransportKind, MemoryConfig, NotifyConfig,
24    NotifyEvent, PriceConfig, QuestionToolConfig, RuntimeLspServer, SecurityConfig, SessionConfig,
25    SlopConfig, StreamRuleConfig, StreamRuleRepeat, StreamRuleScope, SwarmConfig,
26    SystemPromptOverlays, ToolsConfig, TuiConfig, WebSearchConfig, WebSearchCustomConfig,
27    is_discord_webhook_url,
28};
29
30pub use edit::ConfigTarget;
31pub use stream_rules::{parse_rule_markdown, stream_rule_files};
32
33#[cfg(test)]
34pub(crate) use load::{
35    encode_toml, ensure_parent_dir, map_toml_ser, parse_command_markdown,
36    project_websearch_warning, toml_err, write_atomic,
37};
38
39/// `.whycodes/slop.toml` next to project config.
40pub fn project_slop_path(project_dir: &std::path::Path) -> std::path::PathBuf {
41    whycodes_core::project_dir(project_dir).join("slop.toml")
42}
43
44#[cfg(test)]
45mod tests;