from pathlib import Path
import os,sys,shutil
here=Path(__file__).resolve().parent; root=here/'working'/'workspace'
mode=sys.argv[1]
if mode=='manifest-lock-drift':
 p=root/'crates/math_core/Cargo.toml'; p.write_text(p.read_text().replace('version = "0.1.0"','version = "0.2.0"',1))
elif mode=='toolchain-change':
 channel=os.environ.get('TOL005_MUTATION_TOOLCHAIN','nightly-2099-01-01')
 (root/'rust-toolchain.toml').write_text('[toolchain]\nchannel = "'+channel+'"\nprofile = "minimal"\n')
elif mode=='missing-local-dep':
 p=here/'working'/'local_deps'/'text_fmt'; q=here/'working'/'local_deps'/'text_fmt.MISSING'
 if q.exists(): shutil.rmtree(q)
 if not p.exists(): raise SystemExit('reset with setup_fixture.py first')
 p.rename(q)
elif mode=='untested-behavior':
 p=root/'crates/math_core/src/lib.rs'; p.write_text(p.read_text().replace('pub fn risky_double(x: i32) -> i32 { x * 2 }','pub fn risky_double(x: i32) -> i32 { x * 200 }'))
else: raise SystemExit('manifest-lock-drift | toolchain-change | missing-local-dep | untested-behavior')
print(mode)
