`sourcekit-lsp diagnose` tries to automatically scrape crash reports on the user’s machine for compiler arguments. If it finds any, it tries to reduce that swift-frontend crash.
Alternatively, a swift-frontend crash can be reduced by running `sourcekit-lsp reduce-frontend [--toolchain /path/to/toolchain] --frontend-args -all -the frontend --args`
Essentially, this is adding three pieces of functionality:
1. `sourcekit-lsp run-sourcekitd-request` takes a JSON sourcekitd request and a path to `sourcekitd.framework` and executes that request using that sourcekitd. This is basically equivalent to `sourcekitd-test -json-request-path` but it works even if the toolchain with `sourcekitd.framework` doesn’t have a `sourcekitd-test`.
2. `sourcekit-lsp diagnose --request-file` takes a path to a JSON sourcekitd request, gets the source file’s contents from disk and reduces the source file + compiler arguments to create a reduced reproducer. It then copies all files referenced from the compiler arguments to a temporary folder and asks the user to file an issue with that information.
3. `sourcekit-lsp diagnose` without arguments is similar to (2) but looks in OSLog for the last sourcekitd crash.