ok is a scripting language and task runner in one static binary. It replaces hard-to-read bash, Python or JS scripts that need a runtime, and Makefiles. The same script runs on Linux, macOS and Windows.
curl -fsSL https://okrun.dev/install.sh | sh
irm https://okrun.dev/install.ps1 | iex
Downloads the binary for your machine from the latest release and checks its SHA-256. Read the install.sh / install.ps1 source first, or download the binary yourself.
JSON, CSV, YAML and TOML are values, not text to parse. Pipelines read like the task they do, and a script's main signature is its command line, --help included.
# Convert a CSV export to JSON, keeping only active users fn main(input: path, --out: path = "active.json") { read(input) | where .active == "true" | sort .name | write(out) let n = read(out) | count print("wrote {n} users to {out}") }
$ ok active-users.ok users.csv wrote 2 users to active.json $ ok active-users.ok --help Convert a CSV export to JSON, keeping only active users Usage: ok active-users.ok <input> [--out <path>] Arguments: <input> Options: --out <path> [default: active.json] -h, --help print this help
Tasks live in ok.ok. ok self init adds small ./ok and ok.cmd wrappers that fetch the pinned, checksum-verified ok on first use, so contributors and CI just run ./ok build.
let image = "ghcr.io/example/api" # Build the container image task image { let sha = (run git rev-parse --short HEAD).out run docker build -t {image}:{sha} . } # Run the image locally task serve(--port: int = 8080) needs [image] { let sha = (run git rev-parse --short HEAD).out run docker run --rm -p {port}:8080 {image}:{sha} }
$ ok api (~/code/api) image Build the container image serve Run the image locally $ ok serve --port 3000 # runs image first, then serve $ ok --dry-run serve # prints the docker commands without running them
Everything a script needs is in one file you can drop on any machine.
run starts programs directly. Each {value} is exactly one argument, whatever it contains.
Files, globs, paths, regex, time, hashing, HTTPS fetch and zip/tar, the same on every OS. No coreutils needed.
About 6 MB, no runtime, no dependencies. Linux, macOS and Windows on x86-64 and arm64.
Every error points at the line, underlines the problem and, where it can, says how to fix it.
A cloned project's tasks ask before they run, and ask again when the files change.