Skip to content

Commit ef66414

Browse files
authored
Merge pull request #34 from forkzero/fix/33-document-health-code-impact
Document health code impact dimension with remediation hint (#33)
2 parents 0861026 + d72af02 commit ef66414

1 file changed

Lines changed: 94 additions & 2 deletions

File tree

src/main.rs

Lines changed: 94 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,6 +1291,18 @@ fn build_command_catalog() -> serde_json::Value {
12911291
"lattice edit <thesis-id> --status contested",
12921292
"lattice assess"
12931293
]
1294+
},
1295+
{
1296+
"name": "resolve_code_impact",
1297+
"description": "Clear a health FAIL caused by code changes to lattice-tracked files without a corresponding lattice update",
1298+
"steps": [
1299+
"lattice health --format json",
1300+
"lattice get <affected-implementation-id>",
1301+
"lattice verify <IMP-id> satisfies <REQ-id> --tests-pass",
1302+
"lattice edit <IMP-id> --files 'updated-file-list'",
1303+
"git add .lattice/",
1304+
"lattice health --strict --check"
1305+
]
12941306
}
12951307
],
12961308
"commands": [
@@ -1905,6 +1917,10 @@ fn print_grouped_help() {
19051917
" {:<22} Common task-oriented command sequences",
19061918
"lattice help workflows".cyan()
19071919
);
1920+
println!(
1921+
" {:<22} Health dimensions, clearing a FAIL, configuration",
1922+
"lattice help health".cyan()
1923+
);
19081924
println!();
19091925
println!(
19101926
"Use {} for help on a specific command.",
@@ -3427,6 +3443,26 @@ fn run_command(command: Commands) {
34273443
}
34283444
}
34293445

3446+
// Print remediation hint on FAIL (text mode only)
3447+
if verdict == "FAIL" && !is_json(&format) {
3448+
println!();
3449+
if tracked_files_changed > 0 && !lattice_staged {
3450+
println!(
3451+
" {}",
3452+
"Tip: Re-verify bound implementations (lattice verify/edit),".dimmed()
3453+
);
3454+
println!(
3455+
" {}",
3456+
" then stage .lattice/ alongside your code: git add .lattice/".dimmed()
3457+
);
3458+
} else if lint_issues > 0 {
3459+
println!(
3460+
" {}",
3461+
"Tip: Run 'lattice lint --fix' to auto-fix, or address manually.".dimmed()
3462+
);
3463+
}
3464+
}
3465+
34303466
if check && verdict == "FAIL" {
34313467
process::exit(2);
34323468
}
@@ -4789,12 +4825,68 @@ fn run_command(command: Commands) {
47894825
}
47904826
}
47914827
}
4828+
"health" => {
4829+
println!("{}\n", "LATTICE HEALTH".bold());
4830+
println!(
4831+
"{} produces a single PASS/WARN/FAIL verdict from three signals:\n",
4832+
"lattice health".cyan()
4833+
);
4834+
4835+
println!(" {}", "1. Freshness".bold());
4836+
println!(
4837+
" Time gap between the last code commit and the last .lattice/ commit."
4838+
);
4839+
println!(
4840+
" WARN when gap exceeds threshold (default 72h, configurable in config.yaml)."
4841+
);
4842+
println!(" Cleared by committing any .lattice/ change.\n");
4843+
4844+
println!(" {}", "2. Change Pressure".bold());
4845+
println!(" Contested theses + version drift in edge bindings.");
4846+
println!(
4847+
" Indicates the graph is under stress and may need a planning cycle.\n"
4848+
);
4849+
4850+
println!(" {}", "3. Code Impact".bold());
4851+
println!(
4852+
" Files changed since the last .lattice/ commit that are bound in"
4853+
);
4854+
println!(" implementation nodes (lattice-tracked files).");
4855+
println!(
4856+
" This is the diff-coupled signal: you changed code the lattice knows"
4857+
);
4858+
println!(" about, but haven't updated the lattice to reflect it.\n");
4859+
4860+
println!("{}", "CLEARING A FAIL:".bold());
4861+
println!(
4862+
" 1. Re-verify bound implementations: lattice verify/edit the affected nodes"
4863+
);
4864+
println!(" 2. Stage .lattice/ alongside your code: git add .lattice/");
4865+
println!(
4866+
" 3. The gate credits staged .lattice/ changes — no --no-verify needed\n"
4867+
);
4868+
4869+
println!("{}", "FLAGS:".bold());
4870+
println!(
4871+
" {:<20} Also run lint; lint issues escalate to FAIL",
4872+
"--strict".cyan()
4873+
);
4874+
println!(" {:<20} Exit 2 on FAIL (for CI/hooks)", "--check".cyan());
4875+
println!(" {:<20} Output as JSON", "--format json".cyan());
4876+
println!();
4877+
4878+
println!("{}", "CONFIGURATION:".bold());
4879+
println!(
4880+
" freshness_threshold_hours in .lattice/config.yaml (default: 72)"
4881+
);
4882+
}
47924883
other => {
47934884
eprintln!(
4794-
"Unknown help topic: {}. Available topics: {}, {}",
4885+
"Unknown help topic: {}. Available topics: {}, {}, {}",
47954886
other.red(),
47964887
"concepts".cyan(),
4797-
"workflows".cyan()
4888+
"workflows".cyan(),
4889+
"health".cyan()
47984890
);
47994891
std::process::exit(1);
48004892
}

0 commit comments

Comments
 (0)