CLI reference
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 already supplied admitted snapshot.
Commands#
| Command | Input and purpose |
|---|---|
| source-scan | Build and analyze a bounded SwiftPM product with explicit authorization |
| experimental-scan | Preview registered local source patterns without a build |
| doctor | Validate an admitted immutable manifest snapshot |
| stats | Inspect admitted snapshot facts |
| scan | Analyze the manifest snapshot; an explicit findings gate is optional |
| why | Explain one exact canonical subject in that snapshot |
source-scan#
The 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.
OVERVIEW: Opt-in compiler-backed execution/guard analysis of a SwiftPM product.
USAGE: swift-analyzer source-scan --package-path <package-path> --product <product> [--allow-build] [--include-stdio-rules] [--format <format>]
OPTIONS:
--package-path <package-path>
SwiftPM package directory.
--product <product> Library or executable product; bounded Swift targets
and filesystem or locked Git dependencies.
--allow-build Authorize evaluating Package.swift, fetching locked
Git dependencies and a managed indexed build;
analyzed bodies/tests are not run.
--include-stdio-rules Also execute the bounded stdio resource conditions
LIFE-09/10 (eleven conditions total).
--format <format> Report format: human or json. (values: human, json;
default: human)
-h, --help Show help information.experimental-scan#
OVERVIEW: Preview experimental local source rules without a build or index.
USAGE: swift-analyzer experimental-scan [<path>] [--format <format>] [--rule <rule> ...] [--list-rules]
ARGUMENTS:
<path> Swift source file or directory.
OPTIONS:
--format <format> Report format: human or json. (values: human, json;
default: human)
--rule <rule> Enable only this rule; repeat to select multiple
rules.
--list-rules List implemented preview rules.
-h, --help Show help information.doctor#
OVERVIEW: Validate whether an analysis snapshot is trustworthy.
USAGE: swift-analyzer doctor [--manifest <manifest> ...] [--format <format> ...]
OPTIONS:
--manifest <manifest> Path to the analysis manifest.
--format <format> Report format: human or json. (values: human, json)
-h, --help Show help information.stats#
OVERVIEW: Inspect manifest-admitted immutable fact statistics.
USAGE: swift-analyzer stats [--manifest <manifest> ...] [--format <format> ...]
OPTIONS:
--manifest <manifest> Path to the analysis manifest.
--format <format> Report format: human or json. (values: human, json)
-h, --help Show help information.scan#
OVERVIEW: Analyze an immutable snapshot and optionally evaluate the findings
gate.
USAGE: swift-analyzer scan [--manifest <manifest> ...] [--format <format> ...] [--execution-evidence-bundle <execution-evidence-bundle> ...] [--rule <rule> ...] [--gate ...] [--baseline <baseline> ...] [--dispositions <dispositions> ...] [--workflow-instant <workflow-instant> ...]
OPTIONS:
--manifest <manifest> Path to the analysis manifest.
--format <format> Report format: human or json. (values: human, json)
--execution-evidence-bundle <execution-evidence-bundle>
Path to an immutable Phase 12 execution-evidence
bundle.
--rule <rule> Request an opt-in semantic rule.
--gate Evaluate the findings gate.
--baseline <baseline> Path to an immutable scan baseline.
--dispositions <dispositions>
Path to an immutable disposition set.
--workflow-instant <workflow-instant>
Explicit canonical UTC instant used by workflow
evaluation.
-h, --help Show help information.why#
A 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.
OVERVIEW: Explain one exact reachability subject in an immutable manifest
snapshot.
USAGE: 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> ...]
OPTIONS:
--manifest <manifest> Path to the analysis manifest.
--scope <scope> Reachability scope: shipping or repository. (values:
shipping, repository)
--subject <subject> Exact canonical declaration or SCC identity.
--dimension <dimension> Liveness dimension: code, api, abi, or runtime.
(values: code, api, abi, runtime)
--format <format> Report format: human or json. (values: human, json)
--max-paths <max-paths> Maximum number of proof paths.
--max-path-length <max-path-length>
Maximum edges in a proof path.
--max-evidence-nodes <max-evidence-nodes>
Maximum evidence nodes per page.
--max-evidence-depth <max-evidence-depth>
Maximum evidence traversal depth.
--evidence-continuation <evidence-continuation>
Opaque evidence continuation token.
-h, --help Show help information.Registered experimental preview rules#
These 13 selectors belong to experimental-scan, not source-scan.
async.actor-state-check-before-await [V-ASYNC-01, experimental] — Actor state check may be stale after suspension
async.continuation-double-resume [V-ASYNC-07, experimental] — Continuation may be resumed twice
async.swallowed-task-sleep-cancellation-loop [V-ASYNC-10, experimental] — Cancellation from Task.sleep is swallowed in an unconditional loop
correctness.persisted-process-hash [V-COR-02, experimental] — Process-randomized hash reaches persistent preferences
correctness.regex-range-units [V-COR-03, experimental] — Grapheme count supplies a regex UTF-16 range
execution.blocking-in-concurrency-context [V-EXEC-09, experimental] — Blocking call in an explicit concurrency context
lifetime.borrowed-pointer-escape [V-LIFE-01, experimental] — Borrowed buffer base address returned from its access closure
lifetime.stored-closure-self-cycle [V-LIFE-06, experimental] — Stored closure strongly captures its owner
performance.array-fifo-shifts [V-PERF-04, experimental] — Array used as a repeated FIFO
performance.repeated-consumed-materialization [V-PERF-03, experimental] — Repeated consumed materialization
performance.repeated-lazy-consumption [V-PERF-05, experimental] — Repeated lazy pipeline consumption
performance.repeated-linear-traversal [V-PERF-01, experimental] — Repeated linear traversal
performance.repeated-sorting [V-PERF-02, experimental] — Repeated invariant sortingSee Configuration and inputs and JSON and exit codes before automating a workflow.