gripsack

Packages · dotfiles · environments · services · tasks

Your environment,
in one workspace.

Describe your tools and configuration in one typed TypeScript file. Review what grip plans to change, apply it as a transaction, and roll back to a retained generation without rebuilding your packages.

Linux x86_64 & WSL2 Alpha MIT What's new in v0.62.0

01 / How it works

Declare. Plan.
Apply. Keep a way back.

Setting up a machine is usually a pile of commands nobody can replay. Gripsack turns it into a file you can read, review and roll back.

Declare

Write gripsack.ts: packages from release archives or Conda, dotfiles with explicit ownership, environments, Docker services, tasks.

gripsack.ts

Plan

Evaluation runs in a sandbox. Review destination changes and the exact paths selected inside locked packages, without downloading those packages to inspect them.

grip plan

Apply

Before changing a file, grip journals its prior state and re-checks the destination for edits. One atomic rename makes the new generation current.

grip apply

Keep a way back

Each apply records a generation. Rollback uses its retained files and launchers without rebuilding packages; garbage collection lets you retire older generations.

grip rollback

02 / What you declare

One graph.
Six kinds of output.

Bring the user-space pieces you manage into one catalog. Leave the operating system to its own package manager.

Packages

Pin a release archive, solve a coherent Conda environment or import a Pixi lock. Nothing installs into a global prefix; the lockfile is the only source of versions.

Environments

grip run and grip shell put selected packages on your path for one command or one shell, without touching your dotfiles.

Profiles & dotfiles

Keep a file as a symlink, deploy a tracked copy that detects local edits, or own just one marked block inside a shared file.

Docker services

Digest-pinned PostgreSQL, Redis or any image, on loopback ports with explicit health checks. grip down keeps the volumes.

Tasks & checks

Run named commands with prerequisites, locks and postconditions. Watch task stdout as it arrives; step and check progress goes to stderr, not into your pipeline.

03 / Safety

What is proved?
What is tested?

Before replacing a file, gripsack has two jobs: decide whether it may write, then carry out that decision on your filesystem. The rings show where the proof of the first ends and testing of the second begins.

  • Apply and rollbackThe kernel authorizes a whole-file write only over absence, its own observed last write, or (on apply) an object you explicitly take over. Rollback requests the identity recorded by the target generation, not a rebuild.
  • Commit and recoveryRecovery compares the current, previous and target selections by identity. If the result is ambiguous, it stops. Before a journaled leaf write, the run marker, entry and prior evidence survive every crash allowed by the storage model.
  • RetentionGC may not retire the current generation or delete store content a retained generation still references.
  • Tested: interruption and recoveryCrash-injection tests interrupt runs and recovery on an in-memory filesystem. This exercises the machines together; it is not a proof about every crash on a real disk.
  • The host keeps its contractThe driver relies on atomic rename, file and directory sync, and one lifecycle writer. It can detect an outside edit at the final re-check, not one that races the write afterward.
Five trust rings
Before a journaled leaf write, its intent and prior evidence survive the modeled crashes. The host still has to re-check the live file. A mismatch stops the write; another writer’s edit between the last comparison and the mutation can still be overwritten (S5). Recovery after cleanup is a separate question.

The release gate translates the shipped Rust kernel to Lean 4 and checks the proofs. It does not prove the CLI, Linux or the effects of your hooks and containers. Read the guarantees and their assumptions →

04 / Quick start

One file.
One useful change.

A file-only workspace needs no package download and no Docker. Three commands later you have a generation you can roll back to.

Save this as gripsack.ts in its own repository (or run grip init my-env for a scaffold):

gripsack.ts
import {
  defineWorkspace, file, literalText, managedBlock, profile, workspace,
} from "@gripsack/core";

const dotfiles = profile("dotfiles", {
  files: [file({
    content: literalText("export EDITOR=vi\n"),
    destination: managedBlock("~/.profile", "gripsack-editor"),
  })],
});

export default defineWorkspace(() => workspace({ outputs: [dotfiles] }));

From declaration to deployment

After installing grip, then:

  1. 01

    Validate the workspace

    grip check
  2. 02

    Read the proposed changes

    grip plan dotfiles
  3. 03

    Apply when you are ready

    grip apply dotfiles

The rest of ~/.profile stays yours: a managed block owns only the section between its markers. grip generations lists what you can return to; grip rollback returns to it.

05 / Three more shapes

Same file.
Different workspaces.

Each tab is a complete workspace from the guides. The release checks evaluate, check and plan the Conda and Docker examples without starting their services or running their tasks.

gripsack.ts · packages
import {
  defineWorkspace, environment, githubRelease, pkg, provider,
  targetPlatform, workspace,
} from "@gripsack/core";

const target = targetPlatform({ os: "linux", arch: "x86_64", abi: "musl" });
const ripgrep = pkg("ripgrep", {
  producer: provider(githubRelease({
    repo: "BurntSushi/ripgrep",
    asset: "ripgrep-{version.bare}-x86_64-unknown-linux-musl.tar.gz",
  })),
  archiveRoot: { kind: "single_directory" },
  commands: { rg: "rg" },
  target,
  layout: { kind: "relocatable" },
});
const search = environment("search", { packages: ["ripgrep"], target });

export default defineWorkspace(() => workspace({ outputs: [ripgrep, search] }));

A release archive becomes a package; an environment puts rg on the path for one command. Packages guide →

grip update
grip build ripgrep
grip run --env search -- rg --version
gripsack.ts · service
import {
  defineWorkspace, exec, lit, service, task, workspace,
} from "@gripsack/core";

const postgres = service("postgres", {
  image: "docker.io/library/postgres@sha256:979bccfde35445db618c65107d27d08c6c21339d8dc3ad4c830c6633947be0e4",
  ports: [{ address: "127.0.0.1", host: 55432, container: 5432 }],
  volumes: [{ name: "gripsack-guide-postgres18", target: "/var/lib/postgresql" }],
  env: {
    POSTGRES_USER: { kind: "literal", value: "app" },
    POSTGRES_DB: { kind: "literal", value: "app" },
    POSTGRES_PASSWORD: { kind: "inherited", name: "GRIPSACK_POSTGRES_PASSWORD" },
  },
  health: {
    kind: "command",
    argv: ["pg_isready", "-U", "app", "-d", "app"],
    interval_seconds: 2,
    timeout_seconds: 2,
    retries: 30,
  },
});
const databaseReady = task("database-ready", {
  services: ["postgres"],
  steps: [exec({ argv: [lit("/usr/bin/printf"), lit("postgres is healthy\\n")] })],
});

export default defineWorkspace(() => workspace({ outputs: [postgres, databaseReady] }));

A digest-pinned PostgreSQL on loopback, a health check, and a task that requires it to be healthy. The password is inherited from your environment, never written down. Services guide →

: "${GRIPSACK_POSTGRES_PASSWORD:?}"
grip up postgres
grip task run database-ready --closed-stdin
grip down postgres   # keeps the volume
gripsack.ts · task
import {
  bash, conda, defineWorkspace, environment, lit, packageCommand,
  pkg, provider, targetPlatform, task, workspace,
} from "@gripsack/core";

const target = targetPlatform({ os: "linux", arch: "x86_64", abi: "gnu" });
const shell = pkg("shell", {
  producer: provider(conda.environment({
    channels: ["conda-forge"],
    packages: { bash: "*" },
    systemRequirements: {
      libc: { family: "glibc", version: "2.28" },
      linux: "4.18",
    },
  })),
  commands: { bash: "bin/bash" },
  target,
  layout: { kind: "prefix_materialized" },
});
const dev = environment("dev", { packages: ["shell"], target });
const greet = task("greet", {
  environment: "dev",
  steps: [
    bash`printf '%s\n' "$MESSAGE"`
      .interpreter(packageCommand("shell", "bash"))
      .env("MESSAGE", lit("two words"))
      .build(),
  ],
});
export default defineWorkspace(() => workspace({ outputs: [shell, dev, greet] }));

A literal Bash body with a pinned interpreter from Conda and a typed environment binding; no JavaScript interpolation into shell. Tasks guide →

grip update
grip task run greet --closed-stdin

06 / Install

One static binary.
No daemon.

A musl-linked grip with its TypeScript frontend embedded. Docker Engine is needed only for container services; systemd only for schedules. Nothing runs in the background.

Linux x86_64 / WSL2 · Alpha

Install v0.62.0 Release notes and checksums ↗

Keep your OS package manager.
Declare the user-space pieces you choose.

07 / Documentation

Read in order,
or jump in.

Start with a file-only workspace, or go straight to the kind of declaration you need.

A clear boundary

Your tools, not a new operating system.

Keep system packages with apt or your distribution. Gripsack takes the user-space layer — tools, project commands, personal files, project services — and makes it reviewable, repeatable and reversible. Where gripsack fits →