shellkitshellkit
Guide
API reference
Examples
Changelog
Releases
llms.txt
GitHub
  • 简体中文
  • English
Guide
API reference
Examples
Changelog
Releases
llms.txt
GitHub
  • 简体中文
  • English

A starting point for ops shell scripts

A Bash library plus a project generator and a CLI framework, with explicit constraints.

Quick startInstallAPI reference

stdout is for data only

Logs always go to stderr, so $(...) never picks up an [INFO] line.

Output via printf -v

No nameref in 3.2; this is the only reliable return channel.

Baseline is 3.2, not 5.x

The macOS /bin/bash is 3.2.57. Associative arrays and nameref are banned.

Exit codes are an interface

0 through 5 each mean one thing; callers decide on retry from them.

Generate a project in one command

shellkit new ships a vendored library and tests; make test passes immediately.

The AI contract is generated too

Banned syntax and the task map are assembled from a single source of truth.

How the three pieces fit together

The library is the single source of truth: shellkit new vendors it into your project, the CLI covers the daily work
The library is the single source of truth: shellkit new vendors it into your project, the CLI covers the daily work

Full signatures and exit codes: API reference.

Install in one command

curl -fsSL https://github.com/yi-nology/shellkit/releases/latest/download/install.sh | bash

Installs to /usr/local, falling back to ~/.local when not writable. Pin a version or change the prefix:

curl -fsSL https://github.com/yi-nology/shellkit/releases/latest/download/install.sh | PREFIX="$HOME/.local" bash
curl -fsSL https://github.com/yi-nology/shellkit/releases/latest/download/install.sh | VERSION=1.8.0 bash

Current version Download 1.8.0. If the sha256 does not match it exits 5 and writes nothing.

Real terminal output

Every image below was produced by running real commands: each $ line in docs/shots/*.shot is executed and rendered as SVG.

See what the environment is missing; it never blocks the core library
See what the environment is missing; it never blocks the core library
The generated project passes make test immediately
The generated project passes make test immediately
Rename a documented function and the gate goes red instead of rotting quietly
Rename a documented function and the gate goes red instead of rotting quietly

Five hard rules

Each one has a concrete consequence, not a style preference:

  1. stdout carries data only, logs go to stderr. Otherwise $(...) picks up [INFO] and the caller gets a dirty value.
  2. Output through printf -v; never mutate caller variables. Bash 3.2 has no nameref.
  3. Precedence: explicit argument > environment > config file > default. Implemented once, in conf_get_any.
  4. Every write is atomic. Temp file plus mv -f; an interrupted run never leaves half a file.
  5. The library never changes your shell options or your cwd. set -euo pipefail belongs to your entry script.

Read more in Conventions and Bash 3.2.

Where to go next

Your situationStart here
Decide in five minutes whether this is worth itQuick start
Scripts already run in productionFive-step migration
Will upgrading break my scripts?Compatibility policy
A concrete task: config, downloads, retries, lockingCookbook
Exact signature and exit codeAPI reference
Let an AI write the scriptFor AI
See a complete projectExamples
MIT licensed · For AI readers: llms.txt