8000 GitHub - jeslyvarghese/swx: A fast, drop-in companion to SwiftPM: the same Package.resolved and checkouts, byte for byte, several times faster. · GitHub
[go: up one dir, main page]

Skip to content
jeslyvarghesePublic

About

A fast, drop-in companion to SwiftPM: the same Package.resolved and checkouts, byte for byte, several times faster.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

swx

CI Latest release License

Website | User guide | Releases | Contributing

swx: a fast, drop-in companion to SwiftPM

What uv is to pip, for Swift. swx resolves, builds and runs Swift packages, and writes SwiftPM's own files byte for byte, so swx, swift and Xcode can be mixed freely.

  • Fast: cold resolves about 4× faster than SwiftPM, no-ops in 20 ms
  • Drop-in: the same Package.resolved, .build/checkouts and workspace-state.json
  • Nothing to migrate: reads Package.swift as is, honours SwiftPM's flags and configuration
  • Xcode-aware: prepares SourcePackages so xcodebuild builds offline
  • Apple platforms: build, run and test on iOS, watchOS, tvOS and visionOS simulators and devices
  • Hot reload: swx run --hot reloads saved Swift files into the running app, SwiftUI state included, without touching the project
  • Built for agents: --format json reports (diagnostics, failing tests, error codes with fixes), background hot reload with screenshots, and an MCP server
  • Editing dependencies: swx add goes from a package name to a resolved dependency, like uv add; remove and upgrade too
  • Dependency graphs: swx graph as a tree, Graphviz, Mermaid or JSON; show-dependencies without SwiftPM
  • Inspection: why, outdated, audit (known vulnerabilities), licenses, and undeclared imports, with a policy file for CI
  • CI: a GitHub Action, selective testing, resolve --check, and a remote cache (S3, HTTP or a directory) for checkouts and build outputs
  • Monorepos: --all resolves, checks, builds, tests and caches every package of a repository
  • Publishing: swx publish to an SE-0391 registry, signed, as swift package-registry publish does
  • Housekeeping: swx cache size and prune for the store and remote caches, swx self update
  • Toolchains: installs swift.org releases and snapshots, honours .swift-version
  • Tools and scripts: runs package executables like uvx, and single-file scripts with dependencies
  • Verified: every compatibility claim is checked against SwiftPM or Xcode in CI

To learn more, read the user guide.

swx in action

swx add swift-argument-parser            # find it, pick the newest release, add it, resolve
swx upgrade                              # move requirements that exclude the newest releases
swx package resolve                      # same Package.resolved as `swift package resolve`
swx build -c release                     # resolves, then SwiftPM builds with resolution disabled
swx graph                                # targets and the products they use, as a tree
swx audit                                # known vulnerabilities in your pins
swx test --selective                     # only test targets whose inputs changed
swx cache pull --build                   # checkouts and .build from a remote cache (CI)
swx package resolve --all                # every package of a monorepo, one store
swx publish mona.LinkedList 1.2.0        # to a registry, as swift package-registry publish
swx cache prune --older-than 30d         # what no project pins and nothing used lately
swx run --platform ios HelloApp          # build, install and launch on a simulator
swx run --hot --platform ios HelloApp    # …and reload each saved file in the running app
swx xcode resolve --source-packages SourcePackages
swx toolchain install 6.4
swx tool run swiftformat@0.54.0 --version
swx run greet.swift Ada                  # a script with dependencies in a comment

Anything swx doesn't handle is forwarded to swift package.

For coding agents

With --format json (or SWX_FORMAT=json), every command prints one JSON object: a build's errors with file, line and column, a test run's failing tests and why, or an error code with its fix. Apps run with hot reload in the background, so an agent can edit, check what its saves did and look at the result:

swx build --format json                          # {"status":"failed","diagnostics":[{"file":…,"line":12,…}]}
swx hot start --platform ios HelloApp --format json
swx hot status --wait --format json              # reloaded, compile error, or relaunched
swx screenshot --format json                     # a PNG of the running app

swx mcp serves all of it as MCP tools. In Claude Code, add the server or install the plugin (MCP server and skill):

claude mcp add swx -- swx mcp
/plugin install swx --marketplace jeslyvarghese/swx

swx agent-guide prints a one-page guide for AGENTS.md or CLAUDE.md. More in the guide.

Performance

Vapor + Fluent (32 packages) on Apple Silicon with Swift 6.4, both tools starting from empty caches. Cold resolves depend most on the network, so that row is the median of three runs. Every run produced byte-identical Package.resolved and workspace-state.json.

Scenario SwiftPM swx Speedup
Cold resolve 72.5 s 17.3 s 4×
No lockfile, warm cache 13.4 s 1.6 s 8×
Fresh clone (lockfile, no .build) 1.5 s 0.10 s 15×
No-op 0.26 s 0.02 s 13×

Scripts/benchmark.py reproduces these runs. See how it is fast.

Installation

curl -fsSL https://swx.quadratic.xyz/install.sh | sh

This installs the release for your OS and CPU (macOS universal, or a static Linux binary for x86_64 or aarch64) into ~/.local/bin, after checking it against the release's SHA256SUMS. swx self update later replaces it with the newest release, checked the same way.

With Homebrew (the repository is its own tap), or with Mint:

brew tap jeslyvarghese/swx https://github.com/jeslyvarghese/swx && brew install swx
mint install jeslyvarghese/swx
Build swx from source

With Swift 6.1 or later:

git clone https://github.com/jeslyvarghese/swx && cd swx
swift build -c release
cp .build/release/swx ~/.local/bin/
ln -s swx ~/.local/bin/swift-x   # optional: enables `swift x …`

Scripts/build-linux-static.sh builds a fully static musl binary for Linux.

Contributing

Found a difference from SwiftPM? That's a bug: please open an issue. To work on swx, read the contributing guide, which covers the architecture and the differential checks.

License

Apache License v2.0 with Runtime Library Exception, the same license as the Swift Package Manager, from which parts of swx are adapted. See LICENSE.txt and NOTICE.txt.

About

A fast, drop-in companion to SwiftPM: the same Package.resolved and checkouts, byte for byte, several times faster.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0