diff options
Diffstat (limited to 'makima/src/daemon/config.rs')
| -rw-r--r-- | makima/src/daemon/config.rs | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/makima/src/daemon/config.rs b/makima/src/daemon/config.rs index 79c9341..7ed1b74 100644 --- a/makima/src/daemon/config.rs +++ b/makima/src/daemon/config.rs @@ -37,6 +37,43 @@ fn default_true() -> bool { true } +/// Context recovery configuration for task resumption. +#[derive(Debug, Clone, Deserialize)] +#[serde(default)] +pub struct ContextRecoveryConfig { + /// Enable context recovery header injection (default: true). + /// This is an opinionated feature that's always on by default. + #[serde(default = "default_true")] + pub enabled: bool, + + /// Include git status in context recovery (default: true). + #[serde(default = "default_true", alias = "includegitstatus")] + pub include_git_status: bool, + + /// Include recent progress entries from progress.log (default: true). + #[serde(default = "default_true", alias = "includerecentprogress")] + pub include_recent_progress: bool, + + /// Maximum number of progress entries to include (default: 5). + #[serde(default = "default_max_progress_entries", alias = "maxprogressentries")] + pub max_progress_entries: usize, +} + +fn default_max_progress_entries() -> usize { + 5 +} + +impl Default for ContextRecoveryConfig { + fn default() -> Self { + Self { + enabled: true, + include_git_status: true, + include_recent_progress: true, + max_progress_entries: default_max_progress_entries(), + } + } +} + /// Root daemon configuration. #[derive(Debug, Clone, Deserialize)] pub struct DaemonConfig { @@ -63,6 +100,10 @@ pub struct DaemonConfig { /// Repositories to auto-clone on startup. #[serde(default)] pub repos: ReposConfig, + + /// Context recovery settings for task resumption. + #[serde(default, alias = "context_recovery")] + pub context_recovery: ContextRecoveryConfig, } /// Server connection configuration. @@ -171,6 +212,61 @@ impl Default for WorktreeConfig { } } +/// Commit discipline configuration for enforcing structured commits. +#[derive(Debug, Clone, Deserialize)] +#[serde(default)] +pub struct CommitDisciplineConfig { + /// Enable commit discipline (always enabled by default - this is opinionated). + #[serde(default = "default_true")] + pub enabled: bool, + + /// Require tests to pass before commits (optional, controlled by --require-tests flag). + #[serde(default)] + pub require_tests: bool, + + /// Require lint to pass before commits (optional). + #[serde(default)] + pub require_lint: bool, + + /// Commit message format: "conventional" or "simple". + #[serde(default = "default_message_format")] + pub message_format: String, + + /// Custom test command (auto-detected if not set). + #[serde(default)] + pub test_command: Option<String>, + + /// Custom lint command (auto-detected if not set). + #[serde(default)] + pub lint_command: Option<String>, + + /// Timeout for quality checks in seconds. + #[serde(default = "default_check_timeout")] + pub check_timeout_secs: u64, +} + +fn default_message_format() -> String { + "conventional".to_string() +} + +fn default_check_timeout() -> u64 { + 300 // 5 minutes +} + +impl Default for CommitDisciplineConfig { + fn default() -> Self { + Self { + enabled: true, + require_tests: false, + require_lint: false, + message_format: default_message_format(), + test_command: None, + lint_command: None, + check_timeout_secs: default_check_timeout(), + } + } +} + /// Process configuration for Claude Code subprocess execution. #[derive(Debug, Clone, Deserialize)] #[serde(default)] @@ -223,6 +319,10 @@ pub struct ProcessConfig { /// Set to 0 for unlimited (not recommended). Default: 10. #[serde(default = "default_max_iterations", alias = "maxiterations")] pub max_iterations: u32, + + /// Commit discipline configuration. + #[serde(default)] + pub commit_discipline: CommitDisciplineConfig, } fn default_claude_command() -> String { @@ -255,6 +355,7 @@ impl Default for ProcessConfig { bubblewrap: BubblewrapConfig::default(), heartbeat_commit_interval_secs: default_heartbeat_commit_interval(), max_iterations: default_max_iterations(), + commit_discipline: CommitDisciplineConfig::default(), } } } @@ -581,12 +682,14 @@ impl DaemonConfig { bubblewrap: BubblewrapConfig::default(), heartbeat_commit_interval_secs: 300, max_iterations: 10, + commit_discipline: CommitDisciplineConfig::default(), }, local_db: LocalDbConfig { path: PathBuf::from("/tmp/makima-daemon-test/state.db"), }, logging: LoggingConfig::default(), repos: ReposConfig::default(), + context_recovery: ContextRecoveryConfig::default(), } } } |
