Skip to main content

Module commit

Module commit 

Source
Expand description

Commit pass for haz init per AUX-005..AUX-006.

Once the interactive flow has finalised a selection in super::model::Tree, the commit pass:

  1. Computes the project-root set (AUX-005 step 1, delegated to the tree).
  2. Sanitises each project root’s basename to an ID-001..ID-005-valid ProjectName (AUX-005 step 2).
  3. Renders the final .haz/workspace.yml body and the per- project haz.yml bodies (AUX-005 step 3 listing data; the UI prompt for confirmation lives in the TUI driver).
  4. Applies the plan to disk via AUX-006 rename-into-place, writing every haz.yml first and .haz/workspace.yml last so an interrupted run never leaves a workspace referencing a non-existent haz.yml.

Existing haz.yml files are not overwritten per AUX-005 step 2 (“for each path… that does not contain a haz.yml”).

Structs§

CommitPlan
The full commit plan derived from a finalised Tree.
ProjectsEntry
A single entry that will land in .haz/workspace.yml’s projects: list. Ordering is byte-ascending on Self::text so the AUX-005 step 3 listing and the eventual workspace.yml are byte-stable across runs.
ScaffoldedHazYml
A new haz.yml file to scaffold per AUX-005 step 2.

Enums§

CommitPlanError
Sanitisation failure surfaced during plan_commit.

Functions§

apply_commit
Apply plan to disk per AUX-006: write every haz.yml first, then .haz/workspace.yml last, each via the rename-into-place pattern.
plan_commit
Compute the CommitPlan for tree, anchoring relative paths against cwd_host_root.
projects_entries
Convenience accessor for tests / callers that want to inspect the projects: entries without forcing a string render.