Regiodivergent metal-catalyzed rearrangement of 3-iminocyclopropenes into N-fused heterocycles.