Skip to main content

stynx_code_config/domain/
config.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4pub struct Settings {
5    #[serde(default)]
6    pub permissions: PermissionSettings,
7    #[serde(default)]
8    pub model: Option<String>,
9    #[serde(default)]
10    pub hooks: HooksConfig,
11    #[serde(default)]
12    pub max_turns: Option<usize>,
13    #[serde(default)]
14    pub max_tokens: Option<u32>,
15    #[serde(default)]
16    pub effort: Option<String>,
17
18    #[serde(default)]
19    pub commit_attribution: bool,
20
21    #[serde(default)]
22    pub interns: Vec<InternConfig>,
23}
24
25#[derive(Debug, Clone, Default, Serialize, Deserialize)]
26pub struct InternConfig {
27
28    pub name: String,
29
30    pub provider: String,
31
32    pub model: String,
33
34    #[serde(default)]
35    pub description: Option<String>,
36
37    #[serde(default)]
38    pub base_url: Option<String>,
39
40    #[serde(default)]
41    pub api_key_env: Option<String>,
42}
43
44#[derive(Debug, Clone, Default, Serialize, Deserialize)]
45pub struct PermissionSettings {
46    #[serde(default)]
47    pub allow: Vec<String>,
48    #[serde(default)]
49    pub deny: Vec<String>,
50}
51
52#[derive(Debug, Clone, Default, Serialize, Deserialize)]
53pub struct HookEntry {
54    #[serde(default)]
55    pub matcher: Option<String>,
56    pub command: String,
57}
58
59#[derive(Debug, Clone, Default, Serialize, Deserialize)]
60pub struct HooksConfig {
61    #[serde(default, rename = "PreToolUse")]
62    pub pre_tool_use: Vec<HookEntry>,
63    #[serde(default, rename = "PostToolUse")]
64    pub post_tool_use: Vec<HookEntry>,
65    #[serde(default, rename = "Stop")]
66    pub stop: Vec<HookEntry>,
67    #[serde(default, rename = "SessionStart")]
68    pub session_start: Vec<HookEntry>,
69}