Fix CLI recreation logic. Add an example script.