Scripting with Swift is much more pleasant than e.g., bash, but dependencies and packaging are a pain point.
Swift-sh and SwiftScript seem to go down the road of creating a mini-language for configuring dependencies that replicates some of what SPM is doing in Package.swift. Both also create and delegate to temporary SPM projects.
An alternative approach is to treat a script file as a "peer" copy of a single-file executable in some SPM package which has a library (with dependencies). A launcher is responsible for finding the associated package, creating, updating and building the executable if needed, and then invoking the binary.
That's the approach of https://github.com/swift-nest/clutch.
The (Swift bird) "nest" is the package with a "clutch" of related scripts (eggs) sharing a common library and its dependencies (e.g., one nest package for build scripts, another for video processing, etc.).
The user can edit and check in the nest package (and library and executables) as usual. The scripts can be anywhere on the filesystem, and the tool also supports finding nests, listing peers in a nest, emitting peer (templates) to edit, etc.
Otherwise, there have also been efforts to better support scripting in SPM, e.g., https://forums.swift.org/t/swiftpm-support-for-swift-scripts/33126 and https://forums.swift.org/t/pitch-swiftpm-support-for-swift-scripts-revision/46717
Also https://github.com/GeorgeLyon/Shwift helps with actually writing scripts, esp. async support, and Foundation seems to be working on more ergonomic and correct subprocess: https://forums.swift.org/t/review-2nd-sf-0007-subprocess/76547