If you're dumb like me and couldn't get this figured out, the easiest way is to set a constant combinator incrementally in ingredients... e.g. for a belt the gear = 1, bearing ball = 2, bearing = 3, belt = 4.
Then connect it through a arithmetic with each * -1 output each. Then attach it the constant > arithmetic > crafting. Also attach your output chest to arithmetic input.
Essentially it inverts the count of items in the chest and the constant and crafts whatever is least. If you want a shut off, connect the output chest to inserter. Mod works great.