STAYSAIL STATUS · 8 BUILDS · CI ZIG 0.16+
REPO DOWNLOAD MIT
Real-Fruit-Snacks  //  multi-call binary  //  one zig build, every target

STAYSAIL.

binary
~1 MB STATIC
applets
84 × POSIX
targets
8 × NATIVE
stack
Zig 0.16+
01 Premise

The fully-static Zig sibling of mainsail.

mainsail is the Python reference — easy to embed, easy to read. Its README documents three things it can't do: no fully-static Linux binary, no linux-arm64-musl, no macos-x64.

Staysail fills those gaps. zig build -Dtarget=x86_64-linux-musl produces a self-contained binary that runs in distroless/static, on Alpine, anywhere with a kernel. Same applet roster, same flags, same exit codes. Different runtime story.

02 Specs

What's in the box.

BINARY
One ~1 MB static executable · no interpreter · no shared libs · no deps.
APPLETS
84 POSIX utilities — text · files · hashing · archives · network · JSON.
TARGETS
8 native builds — Linux glibc/musl · Windows · macOS · x86_64 + ARM64.
BUILDS
Cross-compile every target from one host · -Dpreset=full/slim/minimal.
TESTS
zig build test ~10ms unit · 87 integration assertions in bats.
STACK
Zig 0.16+ · std.process.Init · comptime applet registry.
03 Quickstart

Download, build, dispatch.

From a release no Zig is required. From source: zig build for the full 84-applet binary, or trim with a preset.

# From a release — no Zig required
$ curl -LO https://github.com/Real-Fruit-Snacks/Staysail/releases/latest/download/staysail-linux-x64
$ chmod +x staysail-linux-x64 && ./staysail-linux-x64 --list

# From source — Zig 0.16+
$ git clone https://github.com/Real-Fruit-Snacks/Staysail && cd Staysail
$ zig build -Doptimize=ReleaseSmall
$ ./zig-out/bin/staysail --list

# Wire up multi-call dispatch so each applet runs by its own name
$ ln -s staysail cat                         # Unix
$ copy staysail.exe cat.exe                  :: Windows
$ ./cat README.md                            # dispatches to the cat applet

# Or have staysail do it for every applet at once
$ staysail install-aliases ~/.local/bin

# Pick exactly the applets you need
$ zig build -Dpreset=full                    # 84 applets (default)
$ zig build -Dapplets=ls,cat,grep,sed,awk     # hand-picked → < 100 KB
04 Reference

The applet surface.

84 utilities organised by category. Every applet implements common POSIX flags. Per-applet caveats live in docs/PARITY.md.

FOUNDATION

cat · echo · printfFoundational text / output
true · false · yesExit-status / fill helpers
pwd · basename · dirnamePath components
mkdir · touch · mv · cp · rmFilesystem mutation

TEXT

head · tail · wc · teeStream slicing & counting
tac · rev · tr · cutReverse / transform
sort · uniq · seq · sleepOrder / sequence / time
expand · unexpand · nl · pasteIndentation & numbering
fold · split · comm · join · columnWrapping & tabular

HEAVY TEXT  // real engines, not stubs

grepPOSIX ERE · -F · -i · -v · -n · -c · -H · -h
seds/regex/repl/[g][i] · d · p · q · = · -n · -i · -e
awkBEGIN/END · regex · expressions · $0..$NF · NR/NF/FS/OFS/ORS
find-exec · -name · -type · -size · -mtime · ! · -a · -o · -delete

FILESYSTEM

ls · stat · du · dfListing & stat
chmod · which · xargsMode · path lookup · arg builder
realpath · truncate · mktemp · ln · ddPath · size · scratch · link · copy

HASHING & ENCODING

md5sum · sha1/256/512sumIdentical SHA-256 of "abc" everywhere
base64 · od · hexdumpBinary inspection

ARCHIVES

tar · gzip · gunzipcreate · extract · list · gz filter · BSD short + long
zip · unzipReads deflate · writes store

NETWORK & JSON

httpcurl-style: GET/POST/PUT/DELETE/HEAD/PATCH · -H · -d · -j · TLS
dig · ncUDP DNS (A/AAAA/MX/TXT/CNAME/NS/PTR) · TCP connect+listen+scan
jq16 builtins · pipes · constructors · if-then-else · -r/-c/-s

SYSTEM

uname · whoami · hostnameIdentity
id · groups · env · dateContext
uuidgen · getopt · timeout · watchHelpers
cmp · diff · fmtCompare & format

LIFECYCLE

install-aliasesSymlink/hardlink/copy applets into a target dir
completionsbash / zsh / fish / powershell
updateAtomic self-update from GitHub releases

CROSS-COMPILE TARGETS  // zig build -Dtarget=...

x86_64-linux-gnuglibc 2.35+
x86_64-linux-muslAlpine · distroless · scratch
aarch64-linux-gnuglibc 2.39+
aarch64-linux-muslAlpine ARM64
x86_64-windows-gnuWindows Intel
aarch64-windows-gnuWindows ARM64
x86_64-macosIntel Mac
aarch64-macosApple Silicon

BUILD VARIABLES  // zig build -D...

preset=full|slim|minBundle preset (default: full)
applets=<list>Hand-pick (overrides preset)
optimize=ReleaseSmallDefault: Debug
target=<triple>Cross-compile target
05 Architecture

Four-layer flow.

Entry → dispatch → comptime registry → applet. The same path whether invoked directly, via subcommand, or through a symlink.

src/
main.zig             // process entry · stdio init · calls dispatch
   ↓
registry.zig         // argv[0] basename match · subcommand fallback
                     // comptime-built applet table from build_options
   ↓
applets/all.zig      // static index · one pub const per applet
                     // active set filtered at compile time
   ↓
applets/<name>.zig   // per-applet · exports name · aliases · help · run

tests/
zig build test       // unit ~10ms
integration/smoke.sh // 87 bats assertions
06 The Family

Same idea, six languages.

Same applet contract. Same flag conventions. Same exit codes. Different size/portability tradeoffs.

ToolLangSizeNotes
rillASM~34 KBPure NASM · no libc
moonrakerLua~1.2 MBEmbedded Lua VM
staysailZig~1 MBSmallest fully native
jibRust~2.4 MB+ jq · http · dig
topsailGo~3.4 MB.deb · .rpm · .apk
mainsailPy~5.5 MBOr ~110 KB .pyz
→ START HERE

One zig build,
every target.

Open repo