rosa: Refactor shared code to the rosa package.