CLI framework with pluggable middleware