Skip to main content

devflow_core/
config.rs

1//! Git-flow branch model.
2//!
3//! DevFlow has no `.devflow.yaml` and no automation toggles — all behavior is
4//! driven by CLI flags (`--mode`, `--agent`, …). The only project configuration
5//! left is the git-flow branch model, and that is hardcoded to opinionated
6//! constants: `main`, `develop`, and the `feature/` prefix.
7
8/// Production/release branch name.
9pub const MAIN: &str = "main";
10/// Development/integration branch name.
11pub const DEVELOP: &str = "develop";
12/// Prefix for per-phase feature branches.
13pub const FEATURE_PREFIX: &str = "feature/";
14
15/// The fixed git-flow branch names used by the current pipeline.
16///
17/// Kept as a struct (rather than bare constants) so the modules that build
18/// branch names — git, ship, agent-result evaluation — can take a single value
19/// and stay readable. `default()` is the only constructor.
20#[derive(Debug, Clone, PartialEq, Eq)]
21pub struct GitFlowConfig {
22    /// Main/production branch name.
23    pub main: String,
24    /// Development/integration branch name.
25    pub develop: String,
26    /// Prefix for feature branches.
27    pub feature_prefix: String,
28}
29
30impl Default for GitFlowConfig {
31    fn default() -> Self {
32        GitFlowConfig {
33            main: MAIN.to_string(),
34            develop: DEVELOP.to_string(),
35            feature_prefix: FEATURE_PREFIX.to_string(),
36        }
37    }
38}
39
40#[cfg(test)]
41mod tests {
42    use super::*;
43
44    #[test]
45    fn default_uses_hardcoded_constants() {
46        let config = GitFlowConfig::default();
47        assert_eq!(config.main, "main");
48        assert_eq!(config.develop, "develop");
49        assert_eq!(config.feature_prefix, "feature/");
50    }
51}