osm-katana/examples/ladder_spelling.rs
//! **The named command that regenerates facett's copy of the tag → rung ladder.**
//!
//! ```text
//! cargo run -p osm-katana --example ladder_spelling \
//! > ../facett/facett-map/osm-katana-ladder.txt
//! ```
//!
//! # Why this exists
//!
//! `facett_map::style::classify_with` / `classify_label` and this crate's
//! [`osm_katana::shared::class::RULES`] are two TEXTS of one taxonomy — an arm-for-arm
//! transcription, with nothing enforcing that they stay in step across two repos. The
//! by-construction fix (lift the kind+tier half into `edda` and have both sides call it)
//! spans three repos and a release cascade and is recorded as DELTA 1's migration target.
//!
//! Until then, facett holds a CHECKED-IN copy of this output and asserts its own
//! classifier against it (`facett_map::style::tests::osm_katana_ladder`). This program is
//! the only way that copy is allowed to be produced: a hand-edited one is a second
//! decision wearing the fixture's clothes.
//!
//! # What makes a stale copy detectable
//!
//! `tests/facett_ladder_fixture.rs` pins this program's output against a literal. Editing
//! `RULES` — the thing that would make facett's copy stale — turns that test red HERE,
//! in the repo where the edit happened, with the regeneration command in the failure
//! message. facett cannot see into this repo; this is what makes the other side notice.
fn main() {
// A header a reader (and the facett-side parser) can orient by. Every line after
// `# rules` is one rule: `<test>><rung>`.
println!("# osm-katana tag → rung ladder — GENERATED, do not hand-edit");
println!("# regenerate: cargo run -p osm-katana --example ladder_spelling");
println!("# crate: osm-katana {}", env!("CARGO_PKG_VERSION"));
println!("# rungs: {:?}", osm_katana::shared::class::RUNGS);
println!(
"# unclassified: {}",
osm_katana::shared::class::UNCLASSIFIED_MIN_ZOOM
);
println!("# tiers");
for t in osm_katana::shared::class::Tier::ladder_spelling().split(',') {
println!("{t}");
}
println!("# rules");
for r in osm_katana::shared::class::rules_spelling().split(',') {
println!("{r}");
}
}