Prepare one exact snapshot
Build the selected SwiftPM executable or library product outside Swift Analyzer. Preserve the compiler-produced Index Store and create a manifest for that exact repository revision, product, target closure, build variant, and toolchain.
The current guide is bounded to the validated apple-swift-6.3.3-macos-arm64 profile. Swift Analyzer consumes the prepared evidence; it does not orchestrate the build or silently substitute a different snapshot.
Four commands, one evidence chain
Each command keeps the same manifest and capability boundary in view. Help is available without a manifest; analysis commands preserve structured outcomes instead of collapsing every run into success or failure.
doctor
Validate manifest structure, the exact toolchain and build identity, compiler data, worlds, and requested capability quality.
stats
Inspect admitted fact and symbol statistics without treating an incomplete snapshot as a closed world.
scan
Build the advisory reachability view and publish human results or canonical JSON.
why
Explain one exact declaration or SCC identity from a scan against the same immutable manifest.
Run the shortest useful sequence
Validate first, read the report, then scan. The commands below are documented grammar, not a claim that a public binary can be downloaded from this site. Preserve the JSON report and process exit code together.
swift-analyzer doctor --manifest snapshot.json --format human
swift-analyzer scan --manifest snapshot.json --format jsonPreserve every outcome
Automation must branch on the documented exit meaning. A produced report and a zero finding count do not override an incomplete capability or failed policy operation.
Exit 0 · complete
The command completed and every capability requested for that invocation was satisfied.
Exit 3 · incomplete
The command produced an incomplete capability result. Exit 3 is not a clean scan.
Other exits stay distinct
Gate failure, invalid input, unusable acquisition data, an invariant failure, and cancellation retain separate exit outcomes.
Explain an exact result
Take the canonical subject identity from scan JSON and ask why against the same manifest. Name, USR, and source-location selectors are not accepted as substitutes, so the explanation cannot silently attach to a different declaration.
swift-analyzer why --manifest snapshot.json \
--scope repository \
--subject '<copy-the-exact-identifier>' \
--dimension code --format humanKeep uncertainty explicit
The absence of known references does not prove that code is unused. A mismatched profile, incomplete source or index membership, an unclosed world, or unmodeled dynamic behavior keeps the affected conclusion unknown.
Correct the snapshot or extend the evidence before relying on a negative result. The current contract authorizes advisory review, not automatic deletion, autofix, or a default blocking findings gate.