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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//! Configuration loader for make.toml lifecycle files
//!
//! This module provides functionality for loading and validating `make.toml` configuration
//! files that define project lifecycle phases, hooks, and workspace structure. It includes
//! poka-yoke validation to prevent invalid configurations from being loaded.
//!
//! ## Features
//!
//! - **Configuration loading**: Load `make.toml` from file paths
//! - **Default fallback**: Provide default configuration when file doesn't exist
//! - **Poka-yoke validation**: Validate phases have commands and hooks are valid
//! - **Error handling**: Clear error messages for configuration issues
//!
//! ## Configuration Structure
//!
//! The `make.toml` file defines:
//! - **Project**: Project metadata (name, type, version, description)
//! - **Workspace**: Workspace structure for monorepos (optional)
//! - **Lifecycle**: Phase definitions with commands
//! - **Hooks**: Before/after hooks for phases (optional)
//!
//! ## Examples
//!
//! ### Loading Configuration
//!
//! ```rust,no_run
//! use crate::lifecycle::loader::load_make;
//! use crate::lifecycle::Result;
//!
//! # fn main() -> Result<()> {
//! let make = load_make("make.toml")?;
//! println!("Project: {}", make.project.name);
//! # Ok(())
//! # }
//! ```
//!
//! ### Loading with Default Fallback
//!
//! ```rust,no_run
//! use crate::lifecycle::loader::load_make_or_default;
//! use crate::lifecycle::Result;
//!
//! # fn main() -> Result<()> {
//! // Returns default config if make.toml doesn't exist
//! let make = load_make_or_default(".")?;
//! # Ok(())
//! # }
//! ```
use ;
use validate_hooks;
use Make;
use Path;
/// Load make.toml from path
/// Validate that all phases have at least one command
///
/// **Poka-yoke**: Prevents phases with no commands from being loaded.
/// Load make.toml from project root, with fallback to default
// Unit tests removed - covered by integration_test.rs:
// - test_load_make_toml (loads and validates make.toml)
// - All tests use LifecycleTestFixture which exercises load_make()
// This provides better coverage with real file I/O