Skip to main content

Module layout

Module layout 

Source
Expand description

The boundary between the layer’s two halves, checked (I2871, I1102).

I2870 lets a directory’s contract declare its layout — the lifecycle of what lives there and what must never appear — and the manifest’s local: block declares the local half’s. This module reads those declarations and refuses what contradicts them, naming the path and the contract. It judges only what is declared: a contract without a layout says nothing, and nothing is refused under it.

What a file is, is read rather than guessed from its name:

  • a tracked file under the tracked half that git’s own ignore rules match is state that does not travel — cache or runtime — committed by mistake;
  • a file under the local half whose bytes are a tracked file of the tracked half, or whose front matter declares the schema of a kind share/kinds.yaml calls canonical, is a copy of authored knowledge.
use majordomus_cli::layout::{LayoutFinding, LayoutReport};
let report = LayoutReport::of(true, None, 3, Vec::new());
assert!(report.passes, "measured and nothing found");
let found = LayoutReport::of(true, None, 3, vec![LayoutFinding {
    path: ".ai/local/rules/copied.md".into(),
    contract: "manifest local".into(),
    excludes: "canonical".into(),
    reason: "a copy of .ai/repo/rules/copied.md".into(),
}]);
assert!(!found.passes);
assert!(!LayoutReport::of(false, Some("no git".into()), 0, Vec::new()).passes);

Structs§

LayoutFinding
One misplaced artifact: a path found in a half whose declared layout excludes it, with the contract that excludes it and why, so a refusal names what to move and where it belongs.
LayoutReport
The answer of the layout check: whether the halves were read, how many paths were judged, and every path a contract excludes. A report that could not read the halves never passes, so silence about a tree nobody measured cannot read as a clean tree.

Functions§

check
Check both halves of repository against their declared layouts.