Dwarf Fortress Stockpile Design

2019911what is the most elegant way to implement a command ordering system for ai for example in dwarf fortress when you mark a forested area for wood.