W-algebras from Chern-Simons theory