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
//! Repository-level validation rules driven by `ito_config::types::ItoConfig`.
//!
//! Unlike `crate::validate`, which checks individual on-disk artifacts
//! (proposals, specs, tasks, audit logs), this module validates the
//! **repository as a whole**: gitignore wiring, coordination worktree
//! symlinks, staged file policy, worktree layout, and so on.
//!
//! The engine is config-aware: each `Rule` declares whether it is active
//! for a given configuration via `Rule::is_active`. Rules that are inactive
//! are skipped silently (they emit no issues and report `active: false` in
//! `list_active_rules` output).
//!
//! Output is rendered via the existing `crate::validate::ValidationReport`
//! envelope so callers in `ito-cli` and elsewhere can reuse rendering and
//! JSON serialization.
//!
//! # Module layout
//!
//! - `rule` — `Rule` trait, `RuleId`, `RuleSeverity`, `RuleContext`.
//! - `registry` — `RuleRegistry` holding the built-in rule list and the
//! `list_active_rules` introspection helper.
//! - `staged` — `StagedFiles` snapshot reader.
//!
//! Subsequent waves add rule implementations:
//!
//! - `coordination_rules` — Wave 2.
//! - `worktrees_rules` — Wave 2.
//! - `pre_commit_detect` — Wave 2.
//! - `audit_rules`, `repository_rules`, `backend_rules` — change `011-06`.
use Path;
use ItoConfig;
use crateProcessRunner;
use crate;
pub use ;
pub use ;
pub use ;
pub use StagedFiles;
/// Run repository validation against the given config and project root.
///
/// Iterates the built-in [`RuleRegistry`], skipping rules that report
/// `is_active(config) == false`, and merges the resulting issues into a
/// single [`ValidationReport`].
///
/// # Parameters
///
/// - `config`: the resolved [`ItoConfig`] for the project. Rules use this to
/// gate themselves (e.g. coordination rules only run when
/// `changes.coordination_branch.storage == Worktree`).
/// - `project_root`: absolute path to the project root.
/// - `staged`: snapshot of the git index, used by rules that only fire on
/// staged paths (e.g. the pre-commit hook flow). Pass
/// [`StagedFiles::empty()`] for full-repo validation.
/// - `runner`: process runner used by rules that need to invoke `git` (e.g.
/// `git check-ignore`). Tests inject mock runners.
/// - `strict`: if `true`, warnings are promoted to errors in the resulting
/// [`ValidationReport`] (matches the existing `--strict` semantics in
/// [`crate::validate`]).
///
/// # Errors
///
/// Engine-level errors are converted to `ERROR`-level
/// [`crate::validate::ValidationIssue`] entries pointing at the failing
/// rule, rather than aborting the whole validation run. The engine itself
/// is infallible.