A judge has ordered Elon Musk’s team to disclose details on its role in mass federal layoffs, intensifying scrutiny over its authority.