Looks like this has been around for a while but was recently extracted into it’s own repository on GitHub.
SwiftSyntax is a set of Swift bindings for the libSyntax library. It allows for Swift tools to parse, inspect, generate, and transform Swift source code.
The example in the readme finds every integer literal in a Swift file and increments it, all in ~30 lines of code. Please go forth and build interesting things with this! 😀