@Override
    protected Model transformWithConfig(TransformContext context, Config config) {
        Predicate<Shape> keepShapesByTag = shape -> config.getExportTagged().stream().noneMatch(shape::hasTag);
        Predicate<Shape> keepTraitDefsByTag = trait -> config.getExportTagged().stream().noneMatch(trait::hasTag);
        Model model = context.getModel();
        ModelTransformer transformer = context.getTransformer();

        int currentShapeCount;
        do {
            currentShapeCount = model.toSet().size();
            model = transformer.removeUnreferencedShapes(model, keepShapesByTag);
            model = transformer.removeUnreferencedTraitDefinitions(model, keepTraitDefsByTag);
        } while (currentShapeCount != model.toSet().size());

        return model;
    }
Gets the set of tags that are used to export shapes.

@return the tags that are used to export shapes.
smithy-build/src/main/java/software/amazon/smithy/build/transforms/RemoveUnusedShapes.java