Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

Swift CLI

$ swift Official Low Risk
Swift.org · Code & DevOps · Apache-2.0 · macos / linux / windows

Official CLI driving the Swift compiler and Swift Package Manager (swift build, swift test, swift package). Exposes swift package dump-package and swift package show-dependencies --format json for structured dependency graphs without triggering builds.

FCRS-1.0 Score
80 /100
Good
High Confidence
Zero-Friction Install
brew install swift
CLI vs MCP Decision CLI Only

Local Swift toolchain and SwiftPM orchestrator; runs directly on Package.swift workspaces.

Agent-Readiness Checklist

Local Probe Evidence
✓ JSON Output
— Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md
Version
Apple Swift version 6.4.2 (swiftlang-6.4.2.1.9 clang-2100.4.1.1)
Startup
545 ms
Exit Codes (help / invalid)
0 / 1
NO_COLOR Clean / Non-TTY Safe
Yes / Safe
Captured --help excerpt
OVERVIEW: Swift compiler

USAGE: swift

OPTIONS:
  -access-notes-path <value>
                          Specify YAML file to override attributes on Swift declarations in this module
  -allow-availability-platforms <platforms>
                          Restrict availability metadata to the given platforms, e.g. 'macOS,Swift'
  -allow-non-resilient-access
                          Ensures all contents are generated besides exportable decls in the binary module, so non-resilient access can be allowed
  -allowable-client <vers>
                          Module names that are allowed to import this module
  -assert-config <value>  Specify the assert_configuration replacement. Possible values are Debug, Release, Unchecked, DisableReplacement.
  -block-availability-platforms <platforms>
                          Remove the given platforms from symbol graph availability metadata, e.g. 'macOS,Swift'
  -build-id <build-id>    Specify the build ID argument passed to the linker
  -cache-compile-job      Enable compiler caching
  -cache-disable-replay   Skip loading the compilation result from cache
  -cas-path <path>        Path to CAS
  -cas-plugin-option <name>=<option>
                          Option pass to CAS Plugin
  -cas-plugin-path <path> Path to CAS Plugin
  -clang-build-session-file <value>
                          Use the last modification time of <file> as the underlying Clang build session timestamp
  -clang-scanner-module-cache-path <value>
                          Specifies the Clang dependency scanner module cache path
  -clang-target-variant <value>
                          Separately set the target we should use for internal Clang instance for the 'zippered' code for macCatalyst
  -clang-target <value>   Separately set the target we should use for internal Clang instance
  -color-diagnostics      Print diagnostics in color
  -compiler-assertions    Enable internal self-checks while compiling
  -const-gather-protocols-list <path>
                          Specify a list of protocols for extraction of conformances 'const values'
  -continue-building-after-errors
                          Continue building, even after errors are encountered
  -coverage-prefix-map <prefix=replacement>
                          Remap source paths in coverage info
  -cxx-interoperability-mode=<value>
                          Enables C++ interoperability; pass 'default' to enable or 'off' to disable
  -debug-info-format=<value>
                          Specify the de

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 18 / 25

swift package dump-package and show-dependencies --format json return clean JSON, though swift build and swift test emit text diagnostics.

  • dump-package and show-dependencies --format json support
  • Non-interactive swift build and swift test
Trust & Safety 20 / 25

Local compilation with no remote write commands, though evaluating Package.swift runs Swift code in a sandboxed manifest process.

  • Local-only writes to .build/ and Package.resolved
Setup & Portability 11 / 15

Preinstalled on macOS via Xcode CLT and officially supported on Linux, while Windows and Xcode-framework builds require heavier setup.

  • First-class on macOS/Linux; partial ecosystem parity on Windows
Utility & Efficiency 13 / 15

Unified compiler, formatter/testing integration, and SwiftPM dependency resolver.

  • Covers builds, testing, and package management in one binary
Maintenance & Lineage 10 / 10

Official Swift.org project maintained by Apple and the Swift community under Apache-2.0.

  • Official swiftlang/swift repository
Docs & Verifiability 8 / 10

Clear Swift.org documentation and subcommand --help hierarchy.

  • Official docs at swift.org/documentation

Security, Auth & Guardrails

Auth Modes
No Auth Config File
Credential Storage

Public packages require no auth; private Swift registries use ~/.swiftpm/configuration/registries.json or system git credentials.

Side Effects
Read-Only Local Write
Cost & Quotas

Apache-2.0 open-source toolchain; completely free.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# Swift CLI (swift) Agent Rules
- Use `swift package dump-package` and `show-dependencies --format json` to inspect `Package.swift` cleanly.
- Note that `Package.swift` executes arbitrary Swift code during evaluation; inspect untrusted manifests before running.

Agent-Ready Command Recipes

Safe Read-Only Queries

Dump resolved Package.swift manifest as JSON
swift package dump-package

Evaluates Package.swift and prints the package targets, products, and dependencies as JSON.

Inspect dependency graph as JSON
swift package show-dependencies --format json

Outputs the resolved SwiftPM dependency tree in JSON.

Controlled Writes & Previews

Build and run SwiftPM tests
swift test --parallel

Compiles targets and executes XCTest/Swift Testing suites concurrently.

Strengths for Agents

  • + swift package dump-package and show-dependencies --format json parse Package.swift reliably.
  • + Seamless integration of compiler, SwiftPM, and swift test.

Caveats & Pitfalls

  • ! swift build and swift test compiler errors are plain text lines rather than JSON.
  • ! iOS/UIKit targets still require xcodebuild on macOS rather than standalone swift build.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI