// the find
mxcl/swift-sh
Easily script with third-party Swift dependencies.
swift-sh lets you run single-file Swift scripts that pull in SwiftPM dependencies, specified via specially formatted import comments. It's for Swift developers who want to write quick automation scripts without the overhead of a full package setup. Think Ruby's inline gemspec or Python's inline pip install, but for Swift.
The import comment syntax is genuinely clever — `import PromiseKit // @mxcl ~> 6.5` is readable and non-invasive, and the parser handles GitHub shortcuts, full URLs, SSH URLs, and local paths. The `eject` command is a nice escape hatch: when your script outgrows itself, you get a proper SPM package without rewriting anything. Xcode integration via `swift sh edit` is a real differentiator — you get autocomplete and indexing on a file that's technically just a script. Active Swift version support is solid, covering 5.1 through 6.0 with a separate manifest for 5.3 compatibility.
The build model is slow — it still shells out to `swift build` under the hood, so your first run of a script with dependencies can take 30–60 seconds while SwiftPM fetches and compiles. There's no lockfile story for scripts themselves; you can pin versions in comments, but there's nothing that prevents a `~>` range from pulling a breaking patch on a CI machine two months from now. The Travis CI badge in the README is dead (Travis changed its free tier), signaling maintenance bandwidth is thin — the project is essentially one person's side project and the README itself mentions sponsorship is needed to justify continued maintenance. Linux support works but isn't a first-class citizen; the `swift sh edit` Xcode flow is macOS-only, so Linux users get a second-tier experience.