{"schemaVersion":"2.0.0","locale":"en","title":"CLI reference","description":"The following help is captured from the documented executable at product 524fa07e. The source-scan workflow is the recommended first experiment; manifest commands require an alread","htmlUrl":"https://docs.swift-analyzer.com/reference/cli/","markdownUrl":"https://docs.swift-analyzer.com/reference/cli/index.md","productRevision":"524fa07e0ae4153c84ac12ae9eb6559df89ec2be","catalogRevision":"4558458d","docsRevision":"1f17ba58ab08627e0de898f1442067b09e960b48cd5605d6529e9275f8930d68","channel":"pre-prod","maturity":"experimental","access":"owner-provided-checkout","markdown":"# CLI reference\n\nThe following help is captured from the documented executable at product 524fa07e. The source-scan workflow is the recommended first experiment; manifest commands require an already supplied admitted snapshot.\n\n## Commands\n\n| Command | Input and purpose |\n| --- | --- |\n| source-scan | Build and analyze a bounded SwiftPM product with explicit authorization |\n| experimental-scan | Preview registered local source patterns without a build |\n| doctor | Validate an admitted immutable manifest snapshot |\n| stats | Inspect admitted snapshot facts |\n| scan | Analyze the manifest snapshot; an explicit findings gate is optional |\n| why | Explain one exact canonical subject in that snapshot |\n\n## source-scan\n\nThe format defaults to human. Build authorization and stdio selection default to false. The package path and product name are required. There is no source-scan --rule or --gate option.\n\n```text\nOVERVIEW: Opt-in compiler-backed execution/guard analysis of a SwiftPM product.\n\nUSAGE: swift-analyzer source-scan --package-path <package-path> --product <product> [--allow-build] [--include-stdio-rules] [--format <format>]\n\nOPTIONS:\n  --package-path <package-path>\n                          SwiftPM package directory.\n  --product <product>     Library or executable product; bounded Swift targets\n                          and filesystem or locked Git dependencies.\n  --allow-build           Authorize evaluating Package.swift, fetching locked\n                          Git dependencies and a managed indexed build;\n                          analyzed bodies/tests are not run.\n  --include-stdio-rules   Also execute the bounded stdio resource conditions\n                          LIFE-09/10 (eleven conditions total).\n  --format <format>       Report format: human or json. (values: human, json;\n                          default: human)\n  -h, --help              Show help information.\n```\n\n## experimental-scan\n\n```text\nOVERVIEW: Preview experimental local source rules without a build or index.\n\nUSAGE: swift-analyzer experimental-scan [<path>] [--format <format>] [--rule <rule> ...] [--list-rules]\n\nARGUMENTS:\n  <path>                  Swift source file or directory.\n\nOPTIONS:\n  --format <format>       Report format: human or json. (values: human, json;\n                          default: human)\n  --rule <rule>           Enable only this rule; repeat to select multiple\n                          rules.\n  --list-rules            List implemented preview rules.\n  -h, --help              Show help information.\n```\n\n## doctor\n\n```text\nOVERVIEW: Validate whether an analysis snapshot is trustworthy.\n\nUSAGE: swift-analyzer doctor [--manifest <manifest> ...] [--format <format> ...]\n\nOPTIONS:\n  --manifest <manifest>   Path to the analysis manifest.\n  --format <format>       Report format: human or json. (values: human, json)\n  -h, --help              Show help information.\n```\n\n## stats\n\n```text\nOVERVIEW: Inspect manifest-admitted immutable fact statistics.\n\nUSAGE: swift-analyzer stats [--manifest <manifest> ...] [--format <format> ...]\n\nOPTIONS:\n  --manifest <manifest>   Path to the analysis manifest.\n  --format <format>       Report format: human or json. (values: human, json)\n  -h, --help              Show help information.\n```\n\n## scan\n\n```text\nOVERVIEW: Analyze an immutable snapshot and optionally evaluate the findings\ngate.\n\nUSAGE: swift-analyzer scan [--manifest <manifest> ...] [--format <format> ...] [--execution-evidence-bundle <execution-evidence-bundle> ...] [--rule <rule> ...] [--gate ...] [--baseline <baseline> ...] [--dispositions <dispositions> ...] [--workflow-instant <workflow-instant> ...]\n\nOPTIONS:\n  --manifest <manifest>   Path to the analysis manifest.\n  --format <format>       Report format: human or json. (values: human, json)\n  --execution-evidence-bundle <execution-evidence-bundle>\n                          Path to an immutable Phase 12 execution-evidence\n                          bundle.\n  --rule <rule>           Request an opt-in semantic rule.\n  --gate                  Evaluate the findings gate.\n  --baseline <baseline>   Path to an immutable scan baseline.\n  --dispositions <dispositions>\n                          Path to an immutable disposition set.\n  --workflow-instant <workflow-instant>\n                          Explicit canonical UTC instant used by workflow\n                          evaluation.\n  -h, --help              Show help information.\n```\n\n## why\n\nA declaration identity names one exact declaration in the snapshot. An SCC identity names a strongly connected component: graph nodes that can all reach each other. Obtain these identities from the supplied snapshot; they are not display names or a text query.\n\n```text\nOVERVIEW: Explain one exact reachability subject in an immutable manifest\nsnapshot.\n\nUSAGE: swift-analyzer why [--manifest <manifest> ...] [--scope <scope> ...] [--subject <subject> ...] [--dimension <dimension> ...] [--format <format> ...] [--max-paths <max-paths> ...] [--max-path-length <max-path-length> ...] [--max-evidence-nodes <max-evidence-nodes> ...] [--max-evidence-depth <max-evidence-depth> ...] [--evidence-continuation <evidence-continuation> ...]\n\nOPTIONS:\n  --manifest <manifest>   Path to the analysis manifest.\n  --scope <scope>         Reachability scope: shipping or repository. (values:\n                          shipping, repository)\n  --subject <subject>     Exact canonical declaration or SCC identity.\n  --dimension <dimension> Liveness dimension: code, api, abi, or runtime.\n                          (values: code, api, abi, runtime)\n  --format <format>       Report format: human or json. (values: human, json)\n  --max-paths <max-paths> Maximum number of proof paths.\n  --max-path-length <max-path-length>\n                          Maximum edges in a proof path.\n  --max-evidence-nodes <max-evidence-nodes>\n                          Maximum evidence nodes per page.\n  --max-evidence-depth <max-evidence-depth>\n                          Maximum evidence traversal depth.\n  --evidence-continuation <evidence-continuation>\n                          Opaque evidence continuation token.\n  -h, --help              Show help information.\n```\n\n## Registered experimental preview rules\n\nThese 13 selectors belong to experimental-scan, not source-scan.\n\n```text\nasync.actor-state-check-before-await [V-ASYNC-01, experimental] — Actor state check may be stale after suspension\nasync.continuation-double-resume [V-ASYNC-07, experimental] — Continuation may be resumed twice\nasync.swallowed-task-sleep-cancellation-loop [V-ASYNC-10, experimental] — Cancellation from Task.sleep is swallowed in an unconditional loop\ncorrectness.persisted-process-hash [V-COR-02, experimental] — Process-randomized hash reaches persistent preferences\ncorrectness.regex-range-units [V-COR-03, experimental] — Grapheme count supplies a regex UTF-16 range\nexecution.blocking-in-concurrency-context [V-EXEC-09, experimental] — Blocking call in an explicit concurrency context\nlifetime.borrowed-pointer-escape [V-LIFE-01, experimental] — Borrowed buffer base address returned from its access closure\nlifetime.stored-closure-self-cycle [V-LIFE-06, experimental] — Stored closure strongly captures its owner\nperformance.array-fifo-shifts [V-PERF-04, experimental] — Array used as a repeated FIFO\nperformance.repeated-consumed-materialization [V-PERF-03, experimental] — Repeated consumed materialization\nperformance.repeated-lazy-consumption [V-PERF-05, experimental] — Repeated lazy pipeline consumption\nperformance.repeated-linear-traversal [V-PERF-01, experimental] — Repeated linear traversal\nperformance.repeated-sorting [V-PERF-02, experimental] — Repeated invariant sorting\n```\n\nSee [Configuration and inputs](https://docs.swift-analyzer.com/reference/inputs/) and [JSON and exit codes](https://docs.swift-analyzer.com/reference/output/) before automating a workflow.\n","anchors":["cli-reference","commands","source-scan","experimental-scan","doctor","stats","scan","why","registered-experimental-preview-rules"]}
