A command line interface that analyzes Swift files to list and run public functions, enabling Swift-based scripting.
Beak is a command line tool that transforms standard Swift files into executable scripts. It analyzes Swift source code to discover public global functions and automatically generates a command line interface for them, making Swift a viable language for scripting and task automation.
Swift developers looking to write scripts, automate tasks, or replace traditional task runners like Make or Rake with Swift code.
Beak leverages Swift's type safety and expressiveness for scripting, offering automatic CLI generation from Swift functions, dependency management via Swift Package Manager, and Xcode integration for code completion.
A command line interface for your Swift scripts
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Beak uses SourceKit to analyze Swift files and automatically builds command-line interfaces for public global functions, eliminating manual CLI boilerplate as shown in the release/install example.
It parses special comments like '// beak: kylef/PathKit @ 1.0.0' to pull in Swift Package Manager dependencies directly from GitHub, simplifying script setup without separate manifests.
The 'beak edit' command generates and opens an Xcode project with dependencies linked, providing full code completion for editing scripts, which enhances development workflow.
Beak allows Swift files to be made executable with shebang lines (e.g., '#!/usr/bin/env beak --path'), enabling direct script running without explicitly invoking Beak, as demonstrated in the tasks.swift example.
Only Int, Bool, and String parameters are natively supported; other types must be passed as raw values, which can lead to compilation errors or require additional handling, as noted in the README.
Optimal functionality, especially code completion via 'beak edit', requires Xcode, making it less useful on Linux or for developers not on macOS, despite basic CLI working cross-platform.
The dependency comment format is proprietary and less intuitive than standard Swift Package Manager manifests, potentially confusing for users accustomed to Package.swift files.
Beak is an open-source alternative to the following products: