A simple single-file bash library of idempotent functions useful for configuration management.
  • Shell 64.4%
  • TypeScript 35.2%
  • Just 0.4%
Find a file
Erik Stephens 4a5c7b8797
All checks were successful
test / unit (push) Successful in 17s
fix tests and s/make/just/
2026-05-16 10:46:16 -07:00
.claude a deno+dax port 2026-04-21 19:51:23 -07:00
.forgejo/workflows fix tests and s/make/just/ 2026-05-16 10:46:16 -07:00
openspec add support for redhat & alpine based distros 2026-04-21 19:53:54 -07:00
test fix tests and s/make/just/ 2026-05-16 10:46:16 -07:00
.gitmodules unit tests 2026-03-16 23:07:50 -07:00
deno.json a deno+dax port 2026-04-21 19:51:23 -07:00
deno.lock a deno+dax port 2026-04-21 19:51:23 -07:00
idem.sh fix tests and s/make/just/ 2026-05-16 10:46:16 -07:00
idem.ts a deno+dax port 2026-04-21 19:51:23 -07:00
Justfile fix tests and s/make/just/ 2026-05-16 10:46:16 -07:00
LICENSE initial commit 2025-10-29 21:43:26 -07:00
README.md fix tests and s/make/just/ 2026-05-16 10:46:16 -07:00

idem.sh

A simple single-file bash library of idempotent functions useful for configuration management.

Tests

Motivation

I was a Señor BigEng Weanie that hungered not just to develop platforms, but be even more meta and develop platforms that produced platforms. Then reality hit me hard bro, and that's coming from someone that grew up near the projects in Glendale, AZ. Translation: "git-r-done before you lose ur job, son" - actually that's my redneck upbringing talkin'. Whether or not I'm speaking your kind of language, stick around for a hot minute to see if anything here worth cherry-picking.

As practioners / developers / programmers / engineers / solutions architects / whatev's, it is up to us to choose the right tool for the job. This is my humble submission as a (not "the") tool to help manage a small fleet of servers - correction: don't see it as a tool but more as a template.

It was inspired by Bash Booster. I tried to introduce it at one org that puckered up when mentioning things like "change control" or "automated, reproducible builds". A decade later after working with "big boy" tooling, I struggled to choose how to manage my personal infrastructure. Managing Kubernetes clusters full time for work had me longing for something that allowed me to focus on more important-to-me things in my spare time instead of keeping up with k8s updates & their indifference to us small-timers without Big NAS solutions.

Usage

Simply "install" this however you see fit. The idea is that you clone & taylor this library to your uses & environments. If looking for more concrete examples, please read this blog post.

idem.ts

A TypeScript port of idem.sh for Deno, using dax for shell execution.

#!/usr/bin/env -S deno run --allow-all
import createIdem from "./idem.ts";

const ctx = createIdem({ dryrun: false }); // dryrun: true by default (safe audit mode)

await ctx.mkdir("/etc/myapp");
await ctx.cp("./config/myapp.conf", "/etc/myapp/myapp.conf");
await ctx.enableUnit("myapp.service");
await ctx.installPkgs("curl", "jq");

if (ctx.hasDrift()) {
  console.log("Configuration was updated.");
}

Each function returns Promise<"unchanged" | "drift" | "failed">. With dryrun: true (the default), drift is detected and logged but no changes are applied.

Type-check with:

deno task check

Caveats

This is old school hacker land: enjoy yourself and take only what you need from it. Copy, paste, and embellish as needed. Do not expect any kind of support, even entertaining your questions - we all got more important things in our lives. If your question/bug/fix is worthy, then the Internet God will bless you with a response, and if you're lucky, maybe a PR. The org behind this repo is not interested in building a community nor becoming rich & famous.