Split command invocation resolution into 2 phases.  Fix commandPath bug.