cli rewrite based on orchard