Compare commits

..
Author SHA1 Message Date
ben 8e3fd8456f dolt remote info 2026-11-20 12:04:52 -05:00
148 changed files with 7 additions and 16293 deletions

No files matched your search

-19
View File
@@ -1,19 +0,0 @@
# chezmoi configuration for the PUBLIC tier.
# Rendered into the config file named by `chezmoi init` (see README.md).
#
# There is deliberately no `encryption` key and no [age] section. The previous
# repo carried both, pointing at ~/.config/chezmoi/key.txt and an age recipient.
# That layer is gone: the one secret in the system is fetched over an
# authenticated HTTPS connection at install time, so there is nothing left on
# disk for a key to unlock. On one of the three machines the identity file was
# already 0 bytes, mode 664 — broken, silently, with nothing surfacing it.
#
# There are deliberately no [data] prompts either. This tier must clone and
# apply on a throwaway VM with nobody at the keyboard, so it may not ask a
# question it cannot answer. Your name, email, signing key and Gitea hosts are
# identity, not configuration; they are prompted once by the PRIVATE tier and
# land in ~/.config/git/config.local and ~/.config/zsh/local.zsh, which this
# tier includes if present and ignores if not.
#
# If this file ever needs a real key, that is a signal worth pausing on: the
# public tier's whole value is that it is the same on every machine.
-93
View File
@@ -1,93 +0,0 @@
# Externals — the shell dependency chain, declared for the first time.
#
# None of these were tracked or declared anywhere before. `.zshrc` sourced
# $ZSH/oh-my-zsh.sh unguarded, so `chezmoi init --apply` on a clean box produced
# a .zshrc that broke the shell it configures, and nothing in the repo said why.
# The guard went into .zshrc in phase 2; the seven entries below are the other
# half — the thing the guard is waiting for.
#
# ORDER MATTERS. chezmoi processes externals in target-path order, so
# `.oh-my-zsh` is cloned before anything under `.oh-my-zsh/custom/`. The theme
# and the two plugins are nested there deliberately: $ZSH_CUSTOM is
# ~/.oh-my-zsh/custom (see .zshrc), and oh-my-zsh's own custom/.gitignore
# excludes everything but example.zsh, so the nested clones do not dirty the
# parent working tree on refresh.
#
# --depth=1 on clone is what each of these projects recommends; a full
# oh-my-zsh history is ~50 MB of bootstrap nobody reads. `pull --ff-only` keeps
# a refresh from ever creating a merge commit in someone else's repo.
[".tmux"]
type = "git-repo"
url = "https://github.com/gpakosz/.tmux.git"
refreshPeriod = "168h"
[".tmux".pull]
args = ["--ff-only"]
[".oh-my-zsh"]
type = "git-repo"
url = "https://github.com/ohmyzsh/ohmyzsh.git"
refreshPeriod = "168h"
[".oh-my-zsh".clone]
args = ["--depth=1"]
[".oh-my-zsh".pull]
args = ["--ff-only"]
[".oh-my-zsh/custom/themes/powerlevel10k"]
type = "git-repo"
url = "https://github.com/romkatv/powerlevel10k.git"
refreshPeriod = "168h"
[".oh-my-zsh/custom/themes/powerlevel10k".clone]
args = ["--depth=1"]
[".oh-my-zsh/custom/themes/powerlevel10k".pull]
args = ["--ff-only"]
[".oh-my-zsh/custom/plugins/zsh-autosuggestions"]
type = "git-repo"
url = "https://github.com/zsh-users/zsh-autosuggestions.git"
refreshPeriod = "168h"
[".oh-my-zsh/custom/plugins/zsh-autosuggestions".clone]
args = ["--depth=1"]
[".oh-my-zsh/custom/plugins/zsh-autosuggestions".pull]
args = ["--ff-only"]
# .zshrc adds this to the plugins array only when this directory exists, and
# only here — it used to be in the array on every platform AND separately
# sourced from /opt/homebrew on macOS, so it loaded twice on mac and not at all
# on Linux. Default branch is `main`, not `master`.
[".oh-my-zsh/custom/plugins/zsh-ai"]
type = "git-repo"
url = "https://github.com/matheusml/zsh-ai.git"
refreshPeriod = "168h"
[".oh-my-zsh/custom/plugins/zsh-ai".clone]
args = ["--depth=1"]
[".oh-my-zsh/custom/plugins/zsh-ai".pull]
args = ["--ff-only"]
# tmux-resurrect and tmux-continuum, which .tmux.conf.local loads with
# `run-shell ~/.tmux/plugins/<name>/<name>.tmux`. Nothing installed them, so a
# fresh box printed two run-shell errors at every tmux start and
# `@continuum-restore on` silently did nothing. They nest under the .tmux
# external, whose own .gitignore excludes plugins/**, so they never dirty it.
#
# There is deliberately no tpm here. The old `.config/tmux/plugins/tpm` entry
# pointed at a directory nothing reads: oh-my-tmux keeps tpm in
# ~/.tmux/plugins/tpm and fetches it itself, and only when `@plugin` lines
# exist, which there are none of.
[".tmux/plugins/tmux-resurrect"]
type = "git-repo"
url = "https://github.com/tmux-plugins/tmux-resurrect.git"
refreshPeriod = "168h"
[".tmux/plugins/tmux-resurrect".clone]
args = ["--depth=1"]
[".tmux/plugins/tmux-resurrect".pull]
args = ["--ff-only"]
[".tmux/plugins/tmux-continuum"]
type = "git-repo"
url = "https://github.com/tmux-plugins/tmux-continuum.git"
refreshPeriod = "168h"
[".tmux/plugins/tmux-continuum".clone]
args = ["--depth=1"]
[".tmux/plugins/tmux-continuum".pull]
args = ["--ff-only"]
-58
View File
@@ -1,58 +0,0 @@
# .chezmoiignore — PUBLIC tier.
#
# This is gitignore syntax. A `#` in the middle of a line becomes part of the
# pattern, silently producing an entry that matches nothing, so every comment
# in this file is on its own line. That mistake was caught by inspection once
# already; it does not announce itself.
#
# Ignoring changes what chezmoi manages. It never removes or modifies a file on
# any machine.
# Repo documentation, not a dotfile. Without this it lands as ~/README.md.
README.md
# The bare-machine installer. It is fetched and run once by curl before
# chezmoi exists; it is not a dotfile. Without this it lands as ~/bootstrap.sh.
bootstrap.sh
# chezmoi's own config directory. Never manage the thing that configures the
# manager.
.config/chezmoi
.config/chezmoi/**
# Nested git checkouts. Configs that are repos get their own repo.
**/.git
**/.git/**
# App-managed state. Each of these is rewritten by the application that owns
# it, so a tracked copy can never match the live one and `chezmoi status` is
# never empty. Carried in the source as a starting point, applied never.
# (herdr's config.toml is not here: it is a `create_` file, which seeds a new
# box once and then leaves herdr's rewrites alone.)
.config/btop/btop.conf
# Claude Desktop profile launchers (personal/work), their xdg-open shims, the
# claude:// dispatcher and their .desktop entries. Claude Desktop on Linux is
# the community package at /usr/bin/claude-desktop; macOS has the real app and
# no .desktop files, so none of this applies there.
{{ if ne .chezmoi.os "linux" }}
.local/bin/claude-personal
.local/bin/claude-work
.local/bin/claude-url-dispatch
.local/share/claude-shims
.local/share/claude-shims/**
.local/share/applications
.local/share/applications/**
{{ end }}
# Belt and braces on the tier boundary. The public repo does not manage any of
# these and must never start: a stray `chezmoi add ~/.config/gh` would
# otherwise sweep up an OAuth token, and the same for the bws token and the
# generated key file. These are the exact paths the phase 3 negative test
# asserts are absent on a public-only machine.
.config/gh/hosts.yml
.config/zsh/secrets.zsh
.config/bitwarden
.config/bitwarden/**
.claude.json
.claude/settings.local.json
-27
View File
@@ -1,27 +0,0 @@
#!/bin/sh
# Say what to run next, using a path that actually works right now.
#
# `dotup` lands in ~/.local/bin, and Ubuntu's stock ~/.profile does add that to
# PATH -- but behind `[ -d "$HOME/.local/bin" ]`, evaluated once, at login. On
# a fresh box the directory does not exist when you log in, so it is not on
# PATH; this apply then creates it; and the shell you are sitting in never
# re-reads .profile. The result is that `dotup` is "command not found" in
# exactly the session that just installed it, and works fine in the next one.
#
# That cannot be fixed from inside a child process -- nothing here can alter
# the PATH of the shell that invoked it. What it can do is stop the user
# guessing: print the absolute path, which always works, and say why the bare
# name does not yet.
#
# Silent once PATH is sorted out, so a routine `chezmoi update` says nothing.
set -eu
command -v dotup >/dev/null 2>&1 && exit 0
[ -x "$HOME/.local/bin/dotup" ] || exit 0
printf '\n' >&2
printf 'Next: ~/.local/bin/dotup\n' >&2
printf '\n' >&2
printf 'Type the path in full. `dotup` on its own will not be found until you\n' >&2
printf 'open a new shell -- ~/.profile only adds ~/.local/bin to PATH if the\n' >&2
printf 'directory already existed when you logged in, and it did not.\n' >&2
@@ -1,64 +0,0 @@
#!/bin/sh
# git has to exist before chezmoi fetches the six git-repo externals.
#
# The documented first command is
#
# sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply <url>
#
# and on a stock box it used to fail here:
#
# chezmoi: .config/tmux/plugins/tpm: exec: "git": executable file not found
#
# chezmoi itself is a static download and installs fine. git is a different
# matter: Ubuntu Server cloud images, the Ubuntu docker image and WSL Ubuntu all
# ship curl and none of them ship git. So the front door of the whole system
# did not open on the most ordinary kind of fresh machine there is.
#
# `run_before_` is the fix rather than a README note, because chezmoi runs these
# before every other target -- externals included. Verified, not assumed: a
# probe script printed "git ABSENT here" and the external failed immediately
# after, in that order.
#
# This exits in microseconds on every machine that already has git, which after
# the first apply is all of them.
set -eu
command -v git >/dev/null 2>&1 && exit 0
printf 'chezmoi: git is required for the shell externals and is not installed.\n' >&2
# Root needs no sudo; a non-root user without sudo cannot do this at all, and
# should be told rather than shown a package manager error.
if [ "$(id -u)" -eq 0 ]; then
SUDO=
elif command -v sudo >/dev/null 2>&1; then
SUDO=sudo
else
printf 'chezmoi: cannot install it -- not root and no sudo. Install git and re-run:\n' >&2
printf 'chezmoi: chezmoi init --apply <url>\n' >&2
exit 1
fi
printf 'chezmoi: installing git...\n' >&2
if command -v apt-get >/dev/null 2>&1; then
${SUDO} env DEBIAN_FRONTEND=noninteractive apt-get update -qq || :
${SUDO} env DEBIAN_FRONTEND=noninteractive apt-get install -y -qq git
elif command -v dnf >/dev/null 2>&1; then ${SUDO} dnf install -y git
elif command -v yum >/dev/null 2>&1; then ${SUDO} yum install -y git
elif command -v pacman >/dev/null 2>&1; then ${SUDO} pacman -Sy --noconfirm git
elif command -v zypper >/dev/null 2>&1; then ${SUDO} zypper --non-interactive install git
elif command -v apk >/dev/null 2>&1; then ${SUDO} apk add --no-cache git
elif command -v brew >/dev/null 2>&1; then brew install git
elif [ "$(uname -s)" = Darwin ]; then
# On macOS `git` is a stub that triggers the Command Line Tools installer,
# which is a GUI dialog -- there is nothing useful to do unattended.
printf 'chezmoi: run `xcode-select --install`, then re-run chezmoi init --apply.\n' >&2
exit 1
else
printf 'chezmoi: no package manager I recognise. Install git and re-run.\n' >&2
exit 1
fi
command -v git >/dev/null 2>&1 \
|| { printf 'chezmoi: git still not on PATH after installing it.\n' >&2; exit 1; }
printf 'chezmoi: git %s installed.\n' "$(git --version | awk '{print $3}')" >&2
@@ -1,32 +0,0 @@
{{- if eq .chezmoi.os "linux" -}}
#!/bin/sh
# Point the claude:// and claude-cli:// URL schemes at our handlers.
#
# ~/.config/mimeapps.list is rewritten by every desktop and by xdg-mime itself,
# so it is not a file this repo can own. Setting the two defaults through
# xdg-mime touches only those two lines.
#
# claude:// -> claude-url-dispatch, which routes OAuth callbacks and
# deep links to the Claude Desktop profile that asked for
# them. The packaged com.anthropic.Claude.desktop starts an
# unflagged instance that cannot keep the sign-in.
# claude-cli:// -> Claude Code's own handler.
#
# Linux only (the template renders empty elsewhere, and chezmoi skips an empty
# script). Skipped with a note when xdg-mime is absent, e.g. a headless box.
# It re-runs when this file changes, or when a handler's .desktop does:
# dispatch {{ include "dot_local/share/applications/claude-url-dispatch.desktop.tmpl" | sha256sum }}
# cli {{ include "dot_local/share/applications/create_claude-code-url-handler.desktop.tmpl" | sha256sum }}
set -u
if ! command -v xdg-mime >/dev/null 2>&1; then
echo "claude URL handlers: xdg-mime not found, skipped" >&2
exit 0
fi
rc=0
xdg-mime default claude-url-dispatch.desktop x-scheme-handler/claude || rc=1
xdg-mime default claude-code-url-handler.desktop x-scheme-handler/claude-cli || rc=1
[ "$rc" -eq 0 ] || echo "claude URL handlers: xdg-mime failed; set them by hand with xdg-mime default" >&2
exit 0
{{ end -}}
-38
View File
@@ -1,38 +0,0 @@
# This repo is public and holds no credential. These patterns are not the
# control that keeps it that way -- `gitleaks detect` over the full history is,
# and it runs with zero allowlist entries. These are here so an accident has to
# be deliberate.
# Anything shaped like a credential
*.age
*.key
*.pem
*_key
*.secret
*_secret
.env
.env.*
!.env.example
# Files the tier boundary says belong elsewhere
private_dot_config/bitwarden/
private_dot_config/gh/hosts.yml
private_dot_config/zsh/secrets.zsh
.chezmoidata/bws.toml
# chezmoi runtime state, never the source
.chezmoistate.boltdb
.chezmoi.toml
!.chezmoi.toml.tmpl
# Picker state and its cached fzf, both machine-local by design
.tests/state/
.tests/fzfver
# Downloaded binaries and scratch space, never source
.tests/bin/
tmp/
# OS junk
.DS_Store
**/dot_DS_Store
-48
View File
@@ -1,48 +0,0 @@
# A stand-in for the Caddy bootstrap endpoint, for testing ops/run-e2e.sh
# without the operator's password.
#
# It reproduces the three behaviours the client depends on:
# correct credentials -> 200 with the blob
# wrong credentials -> 401
# any other path -> connection closed with no response (Caddy's `abort`)
#
# The blob is composed IN MEMORY from credentials already present on this
# machine. Nothing is written to disk and nothing is ever logged.
import base64, os, http.server
USER = os.environ['MU']
PW = os.environ['MP']
ROUTE = os.environ['MR']
with open(os.path.expanduser('~/.config/bitwarden/bws-token')) as f:
bws = f.read().strip()
BLOB = ('PRIVATE_REPO_URL=%s\nBWS_ACCESS_TOKEN=%s\n' % (os.environ['MREPO'], bws)).encode()
WANT = 'Basic ' + base64.b64encode(('%s:%s' % (USER, PW)).encode()).decode()
class H(http.server.BaseHTTPRequestHandler):
protocol_version = 'HTTP/1.0'
def do_GET(self):
if self.path != '/%s/bootstrap.env' % ROUTE:
# Caddy's catch-all is `handle { abort }` -- no response at all, so
# curl reports 000. Closing without writing reproduces that.
self.close_connection = True
return
if self.headers.get('Authorization', '') != WANT:
self.send_response(401)
self.send_header('WWW-Authenticate', 'Basic realm="bootstrap"')
self.send_header('Content-Length', '0')
self.end_headers()
return
self.send_response(200)
self.send_header('Content-Type', 'text/plain')
self.send_header('Content-Length', str(len(BLOB)))
self.end_headers()
self.wfile.write(BLOB)
# the default handler logs every request line to stderr; the path contains
# the route, so it stays quiet
def log_message(self, *a):
pass
http.server.HTTPServer(('0.0.0.0', 8099), H).serve_forever()
-244
View File
@@ -1,244 +0,0 @@
#!/bin/bash
# Phase 5 end-to-end, inside a clean container. Public tier from the live
# anonymous URL, then the private tier through the real bootstrap endpoint.
#
# Credentials arrive in the environment (BOOT_URL/BOOT_USER/BOOT_PW) and are
# never echoed. The public clone URL arrives the same way, as E2E_PUBLIC_URL:
# it names a real host, and this tier is world-readable, so it is passed in
# rather than written down. `:?` means an unset variable aborts here with a
# message, instead of the run failing later as an unattributable clone error.
# Package set is scoped to the private path and its dependency:
# the full manifest install is covered by the fake-package-manager suite, and
# what has never run end to end is bootstrap -> bws -> private repo -> secrets.
set -u
export DEBIAN_FRONTEND=noninteractive
fail() { echo "FAIL: $*"; exit 1; }
apt-get update -qq && apt-get install -y -qq git curl zsh ca-certificates expect >/dev/null 2>&1
# ---- 1. public tier, anonymously, exactly as a stranger would ---------------
sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply \
"${E2E_PUBLIC_URL:?set it to the anonymous clone URL of the public repo}" \
>/dev/null 2>&1 \
|| fail "public tier init"
# Assert the ABSOLUTE path first, before touching PATH.
#
# A real operator has just run the installer in whatever shell they were already
# in, and on a fresh box that is bash. ~/.local/bin is added to PATH only by the
# .zshrc this tier ships -- for a zsh that dotup has not installed yet. So the
# first invocation is necessarily `~/.local/bin/dotup`, which is exactly what
# the README documents, and bare `dotup` is `command not found` on every new
# machine.
#
# This used to read `export PATH=...` and THEN `command -v dotup`, which is a
# vacuous assertion: it proved the export worked, not that the installer put
# anything anywhere. It passed happily while a real bash user hit
# `dotup: command not found`.
[ -x "$HOME/.local/bin/dotup" ] \
|| fail "public apply left no executable at ~/.local/bin/dotup"
# Only now, for the convenience of the rest of this script.
export PATH="$HOME/.local/bin:$PATH"
echo "1. public tier applied: $(chezmoi managed -p absolute | wc -l) files"
# absence assertions BEFORE the private tier exists
[ ! -e "$HOME/.config/zsh/secrets.zsh" ] || fail "secrets.zsh present pre-bootstrap"
[ ! -e "$HOME/.config/bitwarden/bws-token" ] || fail "bws token present pre-bootstrap"
[ ! -d "$HOME/.local/share/dotfiles-private" ] || fail "private tier present pre-bootstrap"
echo "2. public-only machine is clean: no token, no secrets, no private source"
# ---- 2. select the private rows --------------------------------------------
STATE=${XDG_CONFIG_HOME:-$HOME/.config}/dotfiles
mkdir -p "$STATE"
printf 'core/unzip\nprivate/private-repo\nprivate/bws-secrets\n' > "$STATE/selected"
echo " plan says:"; dotup plan 2>&1 | sed 's/^/ /' | grep -v '^ *$' | head -8
# ---- 3. install: unzip via apt. bws must NOT appear here -------------------
# The status was thrown away here, and that is not a detail: with no `set -e`,
# no `pipefail`, and nothing reading `$?` (which was `tail`'s anyway), a run in
# which 36 packages failed to install still reached `echo "E2E PASS"`. Both
# statements were true at once and only one of them was reported. Capture the
# status, print the output, then fail on it.
set -o pipefail
dotup --yes install 2>&1 | sed 's/^/ /' | tail -8
irc=$?
set +o pipefail
[ "$irc" -eq 0 ] || fail "dotup install exited $irc — at least one package did not install"
command -v unzip >/dev/null || fail "unzip not installed"
command -v bws >/dev/null && fail "bws installed by the package phase — it must come from the private tier"
echo "3. unzip installed; bws correctly absent (it is not a manifest package)"
# ---- 4. the private tier, through the real endpoint ------------------------
# TEN answers, not three: dotup asks for the endpoint URL, username and
# password, and then the private repo's .chezmoi.toml.tmpl asks its own seven
# promptStringOnce questions.
#
# They must be answered one at a time, as each prompt appears. Two earlier
# attempts piped all ten in up front through `script` and hung forever on
# `git user.name?`. chezmoi's prompt is a full-screen TUI -- it puts the tty in
# raw mode, and a raw-mode switch done with TCSAFLUSH DISCARDS input already
# sitting in the buffer. Everything pre-fed was written to the pty before
# chezmoi started, so it was thrown away, and the pty then waited on a stdin
# that had already closed. No amount of pre-feeding can work against that
# prompt; the answers have to arrive after it draws.
#
# expect also drops `script`'s worst property: script mirrors its stdin into
# its own output, which published the endpoint password into a session
# transcript once already. Credentials reach expect through the environment
# ($env(...)), never argv, never stdin.
red() { sed -e "s|$BOOT_URL|<BOOT_URL>|g" -e "s|$BOOT_PW|<BOOT_PW>|g" \
-e 's|[0-9a-f]\{32\}|<PATH>|g'; }
export E2E_NAME='E2E Test' E2E_EMAIL='e2e@example.invalid'
timeout 600 expect -f - > /tmp/private.log 2>&1 <<'EXP'
set timeout 180
log_user 1
spawn -noecho dotup private
# A bare `expect -re {pat} { ... }` treats a timeout as "carry on", so a missed
# prompt does not fail -- it silently falls through and every later expect waits
# out its own timeout in turn, surfacing at the 600s ceiling as an unattributed
# hang. Name the prompt that was actually missed instead.
proc wait_for {pat what} {
expect {
-re $pat {}
timeout { send_user "\nTIMEOUT: never saw $what\n"; exit 3 }
eof { send_user "\nEOF before $what -- dotup exited early\n"; exit 4 }
}
}
# dotup's own three: plain `read`, no TUI, so the text is the whole signal.
#
# The FIRST password sent here is deliberately wrong. These credentials are
# asked for at the very end of a run, so a typo used to be fatal -- one wrong
# character and the whole install had to be repeated to get back to this
# prompt. Getting it wrong on purpose is the only way to prove the retry loop
# exists and that the URL and username survive the attempt.
wait_for {Bootstrap URL:} "the bootstrap URL prompt"
send -- "$env(BOOT_URL)\r"
wait_for {Username:} "the username prompt"
send -- "$env(BOOT_USER)\r"
wait_for {Password:} "the password prompt"
send -- "definitely-not-the-password\r"
# The message must name the actual fault. "endpoint refused the credentials"
# was once emitted for a 401, a 404 and an unreachable host alike.
wait_for {wrong username or password} "the wrong-password message"
# Blank keeps the URL and the username, so only the password is retyped. The
# bracketed default in the prompt is what proves they were retained.
wait_for {Bootstrap URL \[} "the retry prompt, with the URL kept"
send -- "\r"
wait_for {Username \[} "the retry username prompt, with the user kept"
send -- "\r"
wait_for {Password:} "the retry password prompt"
send -- "$env(BOOT_PW)\r"
# The private repo's seven, each answered only once its TUI is genuinely ready
# to read.
#
# Matching the prompt TEXT is not enough, and this is a race that passes most of
# the time. chezmoi writes "git user.email?" while the tty is still in cooked
# mode, and only then switches to raw mode -- with TCSAFLUSH, which DISCARDS
# whatever is already sitting in the input buffer. An answer sent on the text
# alone can therefore land in the window before the switch and be thrown away.
# The value is gone, the field sits unsubmitted, and every later expect waits
# out its own timeout: one lost keystroke costs the full 600s ceiling and
# reports as "a prompt went unanswered".
#
# Observed exactly that way -- one run answered all seven, the next lost the
# Enter after user.email. Nothing about the two runs differed but timing.
#
# `\033[?2004h` is bracketed-paste-on, which the TUI emits only AFTER raw mode
# is established. Waiting for it turns "probably ready" into "demonstrably
# ready". Each prompt emits its own, so this is per-answer, not once.
proc ask {pat val} {
wait_for $pat "chezmoi prompt $pat"
wait_for "\033\\\[\\?2004h" "raw mode after $pat (TUI never became ready)"
send -- "$val\r"
}
ask {user\.name} "$env(E2E_NAME)"
ask {user\.email} "$env(E2E_EMAIL)"
# blank accepts the template's default, which is what a real operator does for
# the signing key and the four gitea URLs
ask {signing key} ""
ask {WAN ssh} ""
ask {LAN ssh} ""
ask {WAN web} ""
ask {LAN web} ""
expect eof
catch wait result
exit [lindex $result 3]
EXP
rc=$?
case $rc in
124) fail "dotup private hit the 600s ceiling — expect itself wedged, which its own timeout handlers should have prevented" ;;
3|4) red < /tmp/private.log | tr -d '\r' | tail -6 | sed 's/^/ /'
fail "a prompt went unanswered — see the TIMEOUT/EOF line above for which one" ;;
esac
# `script` mirrors its stdin into the pty output, so the three answers -- the
# secret path and the password among them -- are sitting at the top of that log.
# Redact before anything prints it. Learned the hard way: an earlier run of this
# test published both into a session transcript and they had to be rotated.
red < /tmp/private.log | tr -d '\r' | sed 's/^/ /' | tail -14
# ---- 5. assertions ---------------------------------------------------------
echo
echo "--- verification ---"
command -v bws >/dev/null || fail "bws not installed by the private tier"
echo "bws: $(bws --version 2>&1 | head -1), installed by the private tier"
[ -r "$HOME/.config/bitwarden/bws-token" ] || fail "bws token not written"
m=$(stat -c '%a' "$HOME/.config/bitwarden/bws-token")
[ "$m" = 600 ] || fail "bws token mode $m, want 600"
echo "bws token: present, mode 600"
[ -d "$HOME/.local/share/dotfiles-private" ] || fail "private source not cloned"
sm=$(stat -c '%a' "$HOME/.local/share/dotfiles-private")
case $sm in *00) echo "private source: cloned, mode $sm (go-rwx applied)" ;;
*) fail "private source mode $sm — group/other can read it" ;; esac
[ -f "$HOME/.config/chezmoi/private.toml" ] || fail "private.toml not created"
[ -f "$HOME/.config/chezmoi/chezmoi.toml" ] || fail "public chezmoi.toml missing"
d=$(grep -c '^\s*git' "$HOME/.config/chezmoi/private.toml" 2>/dev/null || echo 0)
echo "configs: chezmoi.toml + private.toml, private has $d identity keys"
[ -r "$HOME/.config/zsh/secrets.zsh" ] || fail "secrets.zsh not generated"
sm=$(stat -c '%a' "$HOME/.config/zsh/secrets.zsh")
[ "$sm" = 600 ] || fail "secrets.zsh mode $sm, want 600"
n=$(grep -c '^export ' "$HOME/.config/zsh/secrets.zsh")
echo "secrets.zsh: mode 600, $n exports (want 8)"
[ "$n" -eq 8 ] || fail "expected 8 exports, got $n"
# the credential must not be in any log dotup produced
if grep -qE '://[^/@[:space:]]*:[^/@[:space:]]+@' /tmp/private.log; then
echo "FAIL: a credential-bearing URL appears in dotup output"; exit 1
fi
echo "log hygiene: no credential-bearing URL in dotup output"
# ...nor in the clone's own config, which is where it used to live forever.
GC="$HOME/.local/share/dotfiles-private/.git/config"
[ -f "$GC" ] || fail "no .git/config in the private source"
grep -qE '://[^/@[:space:]]*:[^/@[:space:]]+@' "$GC" \
&& fail "the git remote in .git/config still carries the token"
echo "git remote: clean — $(git -C "$HOME/.local/share/dotfiles-private" remote get-url origin)"
CRED="${XDG_CONFIG_HOME:-$HOME/.config}/dotfiles/private-credentials"
[ -r "$CRED" ] || fail "credential file not written to $CRED"
cm=$(stat -c '%a' "$CRED")
[ "$cm" = 600 ] || fail "credential file mode $cm, want 600"
echo "credential file: present, mode 600, $(wc -l < "$CRED") line"
# the whole point: a later update must still authenticate, with the token only
# ever coming from that file
git -C "$HOME/.local/share/dotfiles-private" fetch -q 2>/dev/null \
&& echo "later fetch: authenticates from the credential file" \
|| fail "fetch failed — the credential helper did not survive the clone"
# identity arrived
git config --get user.email >/dev/null 2>&1 || fail "git identity not configured"
echo "git identity: configured"
# This was a `|| echo "WARN: …"` that fell straight through to `E2E PASS`, so
# the one assertion about the shell this repo exists to configure could not
# fail. If the login shell is broken, the run is not a pass.
zsh -ic 'exit' >/dev/null 2>&1 || fail "zsh -ic exited non-zero — the login shell this repo configures is broken"
echo "zsh: interactive login clean"
echo
echo "E2E PASS"
-105
View File
@@ -1,105 +0,0 @@
#!/bin/bash
# Phase 5 end-to-end against the live endpoint, in a throwaway container.
#
# RUN IT FROM A NORMAL TERMINAL, NOT FROM INSIDE A CLAUDE SESSION:
#
# bash .tests/e2e.sh
#
# Do NOT run it with the `!` prefix in Claude Code. The output is redacted, but
# the prompt is not worth risking -- and the whole point of this wrapper is that
# the password stays on your side.
#
# The password is never written to disk, never placed on any command line, and
# never printed. It is read from your terminal into a shell variable and handed
# to the container through the environment:
#
# `docker exec -e BOOT_PW` with NO `=value` tells docker to inherit the
# variable from this process. Writing `-e BOOT_PW=secret` would put it in
# docker's own argv, and /proc/<pid>/cmdline is world-readable -- the exact
# bug this test suite was just fixed to stop doing in dotup.
#
# What it proves that the unit suite cannot: that a machine which has only ever
# seen the public repo can reach the real endpoint, authenticate, clone the
# private tier, install bws, render secrets, and end up with no credential in
# its logs or its .git/config.
set -u
C=dotup-e2e
INNER=$(dirname "$0")/e2e-private-tier.sh
[ -r "$INNER" ] || { echo "missing $INNER"; exit 1; }
command -v docker >/dev/null || { echo "docker not installed"; exit 1; }
cleanup() { docker rm -f "$C" >/dev/null 2>&1 || :; unset BOOT_PW; }
trap cleanup EXIT INT TERM
# ---- credentials, from your terminal only -----------------------------------
# No default URL, deliberately. Hardcoding the route here would copy it out of
# Bitwarden and into a git repository, where it would then have to be edited
# every time the route rotates -- and a stale default is worse than no default,
# because it fails looking like a password problem.
printf 'Bootstrap URL (paste from Bitwarden): ' >&2
IFS= read -r BOOT_URL
[ -n "$BOOT_URL" ] || { echo "no URL given"; exit 1; }
# Normalise exactly as dotup does, and for the same reason: the rotation scripts
# print the full file URL, so that is what Bitwarden holds and what gets pasted.
# This wrapper appends /bootstrap.env below, so without stripping it first the
# request becomes .../bootstrap.env/bootstrap.env and the preflight reports
# "wrong password, wrong route, or endpoint down" -- blaming the credentials for
# a URL shape, which is the precise failure dotup was just fixed to stop doing.
# Caught by running this harness with the file URL rather than the directory.
BOOT_URL=${BOOT_URL%/}
BOOT_URL=${BOOT_URL%/bootstrap.env}
# Same reasoning for the public repo's own clone URL: it names the real Gitea
# host, and this tier is public, so it is prompted for rather than committed.
# Set E2E_PUBLIC_URL in your environment to skip the prompt.
if [ -z "${E2E_PUBLIC_URL:-}" ]; then
printf 'Public repo clone URL: ' >&2
IFS= read -r E2E_PUBLIC_URL
fi
[ -n "$E2E_PUBLIC_URL" ] || { echo "no public repo URL given"; exit 1; }
printf 'Username [ben]: ' >&2
IFS= read -r BOOT_USER
BOOT_USER=${BOOT_USER:-ben}
printf 'Password: ' >&2
IFS= read -rs BOOT_PW; printf '\n' >&2
[ -n "$BOOT_PW" ] || { echo "empty password"; exit 1; }
export BOOT_URL BOOT_USER BOOT_PW E2E_PUBLIC_URL
# ---- fail fast: do not spend ten minutes to discover a typo ------------------
# curl -K - reads credentials from stdin rather than argv.
printf 'checking the endpoint... ' >&2
code=$(printf 'user = %s:%s\nsilent\nwrite-out = "%%{http_code}"\noutput = "/dev/null"\n' \
"$BOOT_USER" "$BOOT_PW" | curl -K - -m 20 "${BOOT_URL%/}/bootstrap.env" || true)
if [ "$code" != 200 ]; then
echo "HTTP $code -- wrong password, wrong route, or endpoint down. Nothing was run." >&2
exit 1
fi
echo "200" >&2
# ---- the run ----------------------------------------------------------------
# A stock image with nothing preinstalled. If dotup needs a tool, dotup must
# install it -- that is half of what is being tested.
docker rm -f "$C" >/dev/null 2>&1 || :
docker run -d --name "$C" ubuntu:24.04 sleep infinity >/dev/null || exit 1
docker cp "$INNER" "$C":/root/e2e.sh >/dev/null || exit 1
# -e with a bare NAME inherits from this shell. Never NAME=value.
docker exec -e BOOT_URL -e BOOT_USER -e BOOT_PW -e E2E_PUBLIC_URL "$C" bash /root/e2e.sh
rc=$?
echo
if [ "$rc" -eq 0 ]; then
echo "E2E exited 0"
else
echo "E2E exited $rc -- the container is left running as $C for inspection."
echo "If you shell into it, remember that /tmp/private.log inside contains the"
echo "credentials in cleartext: the inner script has a red() redactor, and the"
echo "one time it was bypassed for a quick tail, a live password was published"
echo "and had to be rotated. Pipe anything you read through it."
trap - EXIT INT TERM # leave the container up; still drop the password
unset BOOT_PW
fi
exit "$rc"
-147
View File
@@ -1,147 +0,0 @@
# Sourced by _fake when it is invoked as `curl`. Stands in for every remote the
# installer talks to, and for nothing else: a URL this file does not recognise
# is a failed download, not a silent success, so a typo'd host or a moved path
# shows up as the failure it would really be.
#
# Knobs, all set by the caller:
# FAKE_BOOT_BLOB file whose contents the bootstrap endpoint returns on 200
# FAKE_BOOT_PW the password that gets a 200; anything else gets a 401
# FAKE_BOOT_CODE force a code (404, 000, 500 ...) whatever the password
# FAKE_BWS_SUMS match (default) | mismatch | absent
# FAKE_FAIL=curl:deb | curl:chezmoi | curl:fzf | curl:docker | curl:claude
# | curl:rustup | curl:font | curl:claude-desktop
# fail just that one download
_fb=$(dirname "$0") # the fakebin directory
url=; out=; prev=; readcfg=0
for a in "$@"; do
case $prev in -o) out=$a ;; -K) [ "$a" = - ] && readcfg=1 ;; esac
case $a in http://*|https://*|get.chezmoi.io|*.io|*.sh) [ -z "$url" ] && url=$a ;; esac
prev=$a
done
cfg=
[ "$readcfg" = 1 ] && cfg=$(cat) # always drain: the writer is a pipe
# Where a download lands is itself under test (DU-H2: the tarballs used to go to
# /tmp/nvim.tgz and be unpacked by `sudo tar`). The directory is private to the
# run and removed before it exits, so its mode can only be observed from in
# here. Recorded beside the argv line _fake has already written.
[ -n "$out" ] && printf 'curl-outdir %s %s\n' "$(dirname "$out")" \
"$(stat -c %a "$(dirname "$out")" 2>/dev/null || echo unknown)" \
>> "${DOTUP_TEST_LOG:?DOTUP_TEST_LOG unset}"
emit() { if [ -n "$out" ]; then cat > "$out"; else cat; fi; }
# A tiny installer script, printed the way get.chezmoi.io and astral.sh print
# theirs. It installs the FAKE of the same name, so whatever it drops behaves
# like every other fake in this directory.
installer() { # $1 tool, $2 default dir
printf '%s\n' \
"b=$2" \
'while [ $# -gt 0 ]; do case $1 in -b) b=$2; shift 2 ;; *) shift ;; esac; done' \
"mkdir -p \"\$b\" && ln -sf $_fb/_fake \"\$b/$1\" && echo \"installed $1 to \$b\""
}
case $url in
*get.chezmoi.io*)
[ "$mode" = chezmoi ] && exit 22
installer chezmoi "\$HOME/.local/bin"; exit 0 ;;
*astral.sh/uv/install.sh*)
installer uv "\$HOME/.local/bin"; exit 0 ;;
*get.docker.com*)
# The vendor's convenience script. It installs the engine and both plugins
# in one pass, so the stand-in drops a single `docker` fake -- `docker
# buildx` and `docker compose` are subcommands of that binary, not separate
# ones. Through emit, because the caller downloads this to a file and runs
# the file rather than feeding it to a shell through a pipe: POSIX sh has no
# pipefail, so the pipe form cannot tell a failed download from a good one.
# FAKE_FAIL=curl:docker is that download failing.
[ "$mode" = docker ] && exit 22
installer docker "\$HOME/.local/bin" | emit; exit 0 ;;
# Claude Code's native installer and rustup-init, both downloaded to a file
# and run from it, the docker shape. Each stand-in drops the fake of the same
# name where the real one would put it, so the post-install `have` is real.
https://claude.ai/install.sh)
[ "$mode" = claude ] && exit 22
installer claude "\$HOME/.local/bin" | emit; exit 0 ;;
https://sh.rustup.rs)
[ "$mode" = rustup ] && exit 22
installer rustup "\${CARGO_HOME:-\$HOME/.cargo}/bin" | emit; exit 0 ;;
# The Claude Desktop apt repository's signing key. Its fingerprint is what the
# fake gpg reports, so the key's content here does not matter -- only that it
# arrived.
https://downloads.claude.ai/claude-desktop/key.asc)
[ "$mode" = claude-desktop ] && exit 22
printf -- '-----BEGIN PGP PUBLIC KEY BLOCK-----\nfake\n' | emit; exit 0 ;;
# A Nerd Fonts release: a real .tar.xz holding one .ttf named for the family,
# so the extract and the "already installed" probe both have something to see.
https://github.com/ryanoasis/nerd-fonts/releases/latest/download/*.tar.xz)
[ "$mode" = font ] && exit 22
f=${url##*/}; f=${f%.tar.xz}
d=$(mktemp -d); : > "$d/${f}NerdFont-Regular.ttf"
tar -cJf - -C "$d" . | emit; rm -rf "$d"; exit 0 ;;
*go.dev/VERSION*)
echo go1.99.0; exit 0 ;;
# ghostty-ubuntu's shape after 1.4.0: the latest release builds only for newer
# Ubuntu, and the asset for this machine's release is in an older one.
*api.github.com/repos/mkasberg/ghostty-ubuntu/releases/latest)
echo ' "browser_download_url": "https://example.invalid/ghostty_9.9-0.ppa1_amd64_99.99.deb"'; exit 0 ;;
*api.github.com/repos/mkasberg/ghostty-ubuntu/releases[?]*)
v=$( . /etc/os-release 2>/dev/null; printf '%s' "${VERSION_ID:-}" )
echo ' "browser_download_url": "https://example.invalid/ghostty_9.9-0.ppa1_amd64_99.99.deb"'
echo " \"browser_download_url\": \"https://example.invalid/ghostty_9.8-0.ppa1_amd64_$v.deb\""
echo " \"browser_download_url\": \"https://example.invalid/ghostty_9.7-0.ppa1_amd64_$v.deb\""; exit 0 ;;
*api.github.com*)
echo ' "browser_download_url": "https://example.invalid/fake_amd64.deb"'; exit 0 ;;
# ------------------------------------------------------------------- fzf ----
# Only the real release path answers. The tarball is built here from the
# version in the URL, so `dotup preflight` reporting "0.74.2" is evidence that
# the pinned version travelled through the URL and into the binary -- not that
# a fixture happened to say so.
https://github.com/junegunn/fzf/releases/download/*)
[ "$mode" = fzf ] && exit 22
f=${url##*/} # fzf-0.74.2-linux_amd64.tar.gz
v=${f#fzf-}; v=${v%%-*}
d=$(mktemp -d); printf '#!/bin/sh\ncase ${1:-} in --version) echo "%s (fake)" ;; esac\nexit 0\n' "$v" > "$d/fzf"
chmod 755 "$d/fzf"; tar -czf - -C "$d" fzf; rm -rf "$d"; exit 0 ;;
# ------------------------------------------------------------------- bws ----
*/sdk-sm/releases/download/*bws-sha256-checksums-*)
case ${FAKE_BWS_SUMS:-match} in
absent) exit 22 ;;
mismatch) s=0000000000000000000000000000000000000000000000000000000000000000 ;;
*) s=$(printf 'PK-fake-bws-zip\n' | sha256sum | cut -d' ' -f1) ;;
esac
v=${url##*bws-sha256-checksums-}; v=${v%.txt}
for t in x86_64-unknown-linux-musl aarch64-unknown-linux-musl macos-universal; do
printf '%s bws-%s-%s.zip\n' "$s" "$t" "$v"
done | emit
exit 0 ;;
*/sdk-sm/releases/download/*.zip)
printf 'PK-fake-bws-zip\n' | emit; exit 0 ;;
# -------------------------------------------------------------- bootstrap ---
*/bootstrap.env)
pw=$(printf '%s\n' "$cfg" | sed -n 's/^user = "[^:]*:\(.*\)"$/\1/p' | head -1)
code=${FAKE_BOOT_CODE:-}
if [ -z "$code" ]; then
if [ "$pw" = "${FAKE_BOOT_PW:-}" ]; then code=200; else code=401; fi
fi
if [ "$code" = 200 ]; then cat "${FAKE_BOOT_BLOB:?FAKE_BOOT_BLOB unset}"; fi
printf '\n%s' "$code"
[ "$code" = 000 ] && exit 7
exit 0 ;;
esac
# --------------------------------------------------------------- anything ---
# A download to a file still has to produce the file; a download of something
# this stand-in has never heard of is a failure, which is the honest answer.
case $url in
*.deb|*.tar.gz|*.tgz)
[ "$mode" = deb ] && exit 22
[ -n "$out" ] && { : > "$out"; exit 0; }
exit 0 ;;
esac
[ -n "$out" ] && { : > "$out"; exit 0; }
exit 22
-202
View File
@@ -1,202 +0,0 @@
#!/bin/sh
# One dispatcher; every fake in this directory is a symlink to it.
#
# The old version of this file did two things wrong, and both let real bugs
# through:
#
# it always succeeded so no test could ever reach an installer's failure
# path -- the apt and npm one-at-a-time retries, the
# "did not install" report, and cmd_install's non-zero
# exit were all unreachable, and all three survived
# being deleted outright.
# it failed OPEN the fakes were PREPENDED to $PATH, so a package
# manager with no fake here fell through to the real
# one. An audit of this suite invoked the host's real
# `brew`. A fake that is missing must be an ERROR, not
# a silent hand-off to the machine.
#
# The second is fixed by seal.sh, which builds a directory holding exactly the
# tools a run may touch -- fakes for anything that installs, downloads or needs
# root, real binaries for the pure ones -- and runs dotup under `env -i` with
# that directory as the WHOLE of PATH. Anything not listed is command-not-found.
#
# ---------------------------------------------------------------- failure ---
# FAKE_FAIL is a comma-separated list of injections:
#
# FAKE_FAIL=brew brew exits 1 every time
# FAKE_FAIL=apt-get:batch apt-get fails only when asked for >1 package,
# which is what a real "unable to locate package"
# inside a batch looks like: the batch dies and
# the one-at-a-time retry is the only thing that
# saves the other thirty.
# FAKE_FAIL=npm:batch the same shape for npm.
# FAKE_FAIL=curl:deb curl fails only for the .deb download.
# FAKE_FAIL=curl:docker curl fails only for the get.docker.com script.
# That is how the docker group's failure path is
# reached: one note_fail, nothing executed, and
# the other two rows reported as not attempted.
#
# Several may be combined: FAKE_FAIL=brew,apt-get:batch
set -u
me=${0##*/}
printf '%s %s\n' "$me" "$*" >> "${DOTUP_TEST_LOG:?DOTUP_TEST_LOG unset}"
# The mode this run injects for THIS tool: "always", a tool-specific word, or
# empty for "behave".
mode=
_oldifs=$IFS
IFS=,
for _e in ${FAKE_FAIL:-}; do
case $_e in
"$me") mode=always; break ;;
"$me":*) mode=${_e#*:}; break ;;
esac
done
IFS=$_oldifs
[ "$mode" = always ] && exit 1
# Count the package-ish arguments of a batch call: everything after the
# subcommand that is not a flag and not the flag's value.
count_pkgs() {
n=0
for a in "$@"; do
case $a in
-*|install|update|show|get|tool|-g|-y|--*) continue ;;
*=*) continue ;;
esac
n=$((n + 1))
done
printf '%s\n' "$n"
}
case $me in
apt-get)
case ${1:-} in update) exit 0 ;; esac
[ "$mode" = batch ] && [ "$(count_pkgs "$@")" -gt 1 ] && exit 1
exit 0 ;;
npm)
[ "$mode" = batch ] && [ "$(count_pkgs "$@")" -gt 1 ] && exit 1
exit 0 ;;
apt-cache)
# Stand in for a real apt cache. Two names are special, and both are real
# behaviours of stock Ubuntu that the installer has to tell apart:
#
# gh genuinely absent -- `apt-cache policy` prints nothing. The
# manifest's real example of a name that falls through to brew.
# nvidia-container-toolkit
# present in the cache but with `Candidate: (none)`: it is
# published from NVIDIA's own repository, which nothing here
# configures. `apt-cache show` exits 0 for this, which is why
# the old probe kept it in the batch and let apt refuse all
# thirty packages at once. (docker-ce used to be this example;
# the docker rows install from get.docker.com now and never
# reach apt at all, so the live case is NVIDIA's.)
case ${1:-} in
policy)
case ${2:-} in
gh) exit 0 ;;
nvidia-container-toolkit) printf '%s:\n Installed: (none)\n Candidate: (none)\n' "$2"; exit 0 ;;
esac
printf '%s:\n Installed: (none)\n Candidate: 1.0-fake\n' "$2"; exit 0 ;;
esac
case ${2:-} in gh) exit 100 ;; esac
printf 'Package: %s\n' "${2:-}"; exit 0 ;;
unzip)
# `unzip -oq <zip> -d <dir>` -- produce the one member ensure_bws looks for.
d=; prev=
for a in "$@"; do [ "$prev" = -d ] && { d=$a; break; }; prev=$a; done
[ -n "$d" ] || exit 1
mkdir -p "$d" && printf '#!/bin/sh\necho "bws 2.1.0"\n' > "$d/bws" \
&& chmod 755 "$d/bws" && exit 0
exit 1 ;;
dpkg)
# install_deb fills %a in a gh: asset name from this.
case ${1:-} in --print-architecture) echo amd64 ;; esac
exit 0 ;;
chezmoi)
# `chezmoi init --apply --source DIR -c CFG URL`. Produce the shape the
# caller checks for -- a source tree with a .git in it -- and NOTHING else,
# at the caller's umask, so a missing `chmod -R go-rwx` is visible as a mode.
src=; prev=
for a in "$@"; do [ "$prev" = --source ] && { src=$a; break; }; prev=$a; done
[ -n "$src" ] || exit 0
mkdir -p "$src/.git" && : > "$src/.git/config" && : > "$src/README" || exit 1
exit 0 ;;
curl) . "$(dirname "$0")/_curl" ;;
gpg)
# `gpg --show-keys --with-colons KEY`: one fpr record. FAKE_GPG_FPR stands in
# for a key that is not the one Anthropic publishes.
printf 'pub:-:4096:1:BAA929FF1A7ECACE:0:::-:::scESC::::::23::0:\n'
printf 'fpr:::::::::%s:\n' "${FAKE_GPG_FPR:-31DDDE24DDFAB679F42D7BD2BAA929FF1A7ECACE}"
exit 0 ;;
go)
# `go env GOBIN` is empty and GOPATH is ~/go, which is the stock layout.
# `go install MOD@latest` drops a fake of the module's last segment in
# ~/go/bin, so a second run can see it. FAKE_FAIL=go:install fails them.
case ${1:-} in
env) case ${2:-} in GOPATH) echo "$HOME/go" ;; esac; exit 0 ;;
install)
[ "$mode" = install ] && exit 1
t=${2%@*}; t=${t##*/}
mkdir -p "$HOME/go/bin" && ln -sf "$(dirname "$0")/_fake" "$HOME/go/bin/$t"
exit 0 ;;
esac
exit 0 ;;
herdr)
# `herdr integration status` lists one `<agent>: <state> (...)` line per
# integration; FAKE_HERDR_CURRENT names the agents to report `current`,
# every other one is `not installed`. The paths are the real ones' shape.
# `install` writes nothing, but like the real herdr it fails when the
# target's directory is missing: herdr does not create ~/.omp/agent/extensions.
_herdr_target() {
case $1 in
pi) echo "$HOME/.pi/agent/extensions/herdr-agent-state.ts" ;;
omp) echo "$HOME/.omp/agent/extensions/herdr-omp-agent-state.ts" ;;
claude) echo "$HOME/.claude/hooks/herdr-agent-state.sh" ;;
codex) echo "$HOME/.codex/herdr-agent-state.sh" ;;
*) echo "$HOME/.$1/hooks/herdr-agent-state.sh" ;;
esac
}
case ${1:-}:${2:-} in
integration:status)
for _a in pi omp claude codex copilot; do
case " ${FAKE_HERDR_CURRENT:-} " in
*" $_a "*) printf '%s: current (v11) (%s)\n' "$_a" "$(_herdr_target "$_a")" ;;
*) printf '%s: not installed (%s)\n' "$_a" "$(_herdr_target "$_a")" ;;
esac
done ;;
integration:install)
[ "$mode" = install ] && exit 1
_t=$(_herdr_target "${3:-}")
[ -d "${_t%/*}" ] || { echo "error: ${_t%/*}: No such file or directory" >&2; exit 1; } ;;
esac
exit 0 ;;
nvim)
# Behaves like lazy.nvim's first start: a plain boot creates the plugin
# directory and REWRITES lazy-lock.json with drifted commits, which is the
# bug the installer's first-boot step exists to undo. `+Lazy! restore`
# records the lockfile it was handed in ~/.nvim-restored-from. Injections:
# FAKE_FAIL=nvim:boot and FAKE_FAIL=nvim:restore.
_lock=${XDG_CONFIG_HOME:-$HOME/.config}/nvim/lazy-lock.json
case "$*" in
*'Lazy! restore'*)
[ "$mode" = restore ] && exit 1
cp "$_lock" "$HOME/.nvim-restored-from"; exit 0 ;;
esac
mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/nvim/lazy/lazy.nvim"
[ -f "$_lock" ] && printf '{ "drifted": "tip" }\n' > "$_lock"
[ "$mode" = boot ] && exit 1
exit 0 ;;
fzf)
# The picker's own fzf, and the only fake here whose ARGV is the thing
# under test. `--bind` strings are built across a dozen continued lines, so
# one stray comment between them silently truncates the command and the
# picker draws with two binds instead of seven. Dump argv one argument per
# line -- a bind that lost its continuation cannot masquerade as one that
# survived -- and behave like an accept: read the piped rows, print nothing.
case ${1:-} in --version) echo "${FAKE_FZF_VERSION:-9.9.9} (fake)"; exit 0 ;; esac
[ -n "${FAKE_FZF_ARGV:-}" ] && printf '%s\n' "$@" > "$FAKE_FZF_ARGV"
cat > /dev/null
exit "${FAKE_FZF_RC:-0}" ;;
esac
exit 0
-4
View File
@@ -1,4 +0,0 @@
#!/bin/sh
# Stands in for a Mac. The macOS half of the manifest has no CI anywhere, and
# resolution is pure data, so it can be checked from here.
case ${1:-} in -m) echo arm64 ;; *) echo Darwin ;; esac
-42
View File
@@ -1,42 +0,0 @@
# A box shaped like one you would actually be handed, not one shaped to make
# the tests pass.
#
# Three details are load-bearing, and each of them hid a real bug:
#
# non-root user the old harness ran as root, where ~/.local/bin, sudo and
# $HOME all behave differently.
# bash login Ubuntu's own ~/.profile prepends ~/.local/bin ONLY if that
# directory already exists when the shell starts. A session
# opened before the install therefore does NOT have it, which
# is precisely why `dotup` came back "command not found" on a
# real machine and never once in CI.
# curl but no git the cloud images ship curl; git arrives with chezmoi's
# installer or not at all.
#
# Nothing else is pre-installed. Anything the tests need beyond this -- expect,
# zsh -- is installed by the scenario that needs it, so a dependency can never
# be silently satisfied by the image.
ARG BASE=ubuntu:24.04
FROM ${BASE}
ARG USER=ben
ARG UID=1001
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -qq \
&& apt-get install -y -qq --no-install-recommends \
ca-certificates curl sudo locales tzdata \
&& locale-gen en_US.UTF-8 >/dev/null 2>&1 \
&& rm -rf /var/lib/apt/lists/*
# `ubuntu` already owns 1000 in 24.04, so take the next id rather than fighting
# it. Passwordless sudo matches a cloud image; the installer must never assume
# it, but it must work when it is there.
RUN useradd -m -u ${UID} -s /bin/bash ${USER} \
&& printf '%s ALL=(ALL) NOPASSWD:ALL\n' "${USER}" > /etc/sudoers.d/90-${USER} \
&& chmod 440 /etc/sudoers.d/90-${USER}
ENV LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
USER ${USER}
WORKDIR /home/${USER}
CMD ["sleep", "infinity"]
-22
View File
@@ -1,22 +0,0 @@
#!/bin/sh
# The fake private repo copies three files verbatim from the real one, so the
# scenarios measure the shipping implementation rather than a paraphrase of it.
# A verbatim copy silently stops being verbatim the moment the original is
# edited -- which happened within the hour of creating it. Check, don't hope.
set -eu
cd "$(dirname "$0")"
REAL=${1:-$HOME/code/dotfiles-private}
rc=0
for f in .chezmoiignore run_after_50-secrets.sh.tmpl \
dot_local/bin/private_executable_dotsecrets.tmpl; do
if [ ! -f "$REAL/$f" ]; then
echo "MISSING in the real repo: $f" >&2; rc=1; continue
fi
if ! diff -q "$REAL/$f" "fake-private/$f" >/dev/null; then
echo "DRIFTED: fake-private/$f no longer matches $REAL/$f" >&2
echo " fix: cp '$REAL/$f' '$PWD/fake-private/$f'" >&2
rc=1
fi
done
[ "$rc" -eq 0 ] && echo "fake-private: all three verbatim copies match the real repo"
exit $rc
@@ -1,48 +0,0 @@
# chezmoi configuration for the PRIVATE tier.
#
# Seven questions, asked once at `chezmoi init` and never again -- promptStringOnce
# reads the value already in the config if there is one. Nothing here is fetched
# over a network: your own name is not a rotatable secret, and making `apply`
# depend on an API call to learn your email address would be absurd.
#
# There is deliberately no `encryption` key and no [age] section. The one secret
# in this repo is an ordinary 600-mode file; see README.md for why that is the
# cheaper answer than a per-machine root secret that was already 0 bytes on one
# machine in three.
#
# WHERE THIS FILE LANDS -- read before changing the aliases.
# `dotup` runs `chezmoi init --apply --source ~/.local/share/dotfiles-private
# -c ~/.config/chezmoi/private.toml <url>`, so this template renders to
# private.toml and the public tier keeps chezmoi.toml. The `cmp` alias carries
# the same -c. Two sources, two configs, no overlap.
#
# It was not always so, and the bug is worth remembering. Both tiers rendered
# to the DEFAULT config path, so re-running the public installer overwrote this
# file and took the seven answers below with it. Nothing failed at the time:
# the templates degrade politely when their data is missing -- config.local
# emits a comment telling you to re-run init rather than failing the apply --
# so the symptom was `git commit` not knowing who you are, days later, with
# nothing pointing back at the install that caused it. A loud failure would
# have been a smaller bug.
#
# The same goes for the PERSISTENT STATE. chezmoi keeps it next to the config
# file, so both tiers shared ~/.config/chezmoi/chezmoistate.boltdb: each wrote
# its own config-template hash and run_onchange hashes over the other's, and
# after the private init every public command warned "config file template has
# changed". Running the init it suggests only moved the warning to this tier.
# So this tier gets its own state file, beside private.toml. This key covers a
# bare `chezmoi -c private.toml`; `dotup` and `cmp` also pass the same path as
# --persistent-state, because `init` opens the state BEFORE it writes this key,
# so the first init (or a re-init from a config that predates it) would
# otherwise record its hash in the public tier's file.
persistentState = {{ joinPath (dir .chezmoi.configFile) "chezmoistate-private.boltdb" | quote }}
[data]
gitName = {{ promptStringOnce . "gitName" "git user.name" | quote }}
gitEmail = {{ promptStringOnce . "gitEmail" "git user.email" | quote }}
gitSigningKey = {{ promptStringOnce . "gitSigningKey" "git signing key id (blank for none)" "" | quote }}
giteaWanSsh = {{ promptStringOnce . "giteaWanSsh" "gitea WAN ssh prefix" "ssh://git@git.example.invalid:222/" | quote }}
giteaLanSsh = {{ promptStringOnce . "giteaLanSsh" "gitea LAN ssh prefix" "ssh://git@10.99.99.99:2223/" | quote }}
giteaWanWeb = {{ promptStringOnce . "giteaWanWeb" "gitea WAN web url" "https://git.example.invalid/" | quote }}
giteaLanWeb = {{ promptStringOnce . "giteaLanWeb" "gitea LAN web url" "http://10.99.99.99:3001/" | quote }}
@@ -1,43 +0,0 @@
# Fake stand-in for the private tier's bws map. Same STRUCTURE as the real one
# -- seven secrets and one alias -- because `dotsecrets` is copied verbatim and
# the "8 exports, not 7" assertion depends on that cardinality.
#
# The ids are sequential and obviously synthetic. They are not secrets in the
# real repo either (a UUID fetches nothing without the machine token), but a
# fake tree should be unmistakably fake at a glance.
[bws]
project = "00000000-0000-4000-8000-000000000000"
[[bws.secrets]]
env = "LAB_ALPHA_API_KEY"
id = "00000000-0000-4000-8000-000000000001"
[[bws.secrets]]
env = "LAB_BRAVO_API_KEY"
id = "00000000-0000-4000-8000-000000000002"
[[bws.secrets]]
env = "LAB_CHARLIE_API_KEY"
id = "00000000-0000-4000-8000-000000000003"
[[bws.secrets]]
env = "LAB_DELTA_API_KEY"
id = "00000000-0000-4000-8000-000000000004"
[[bws.secrets]]
env = "LAB_ECHO_API_KEY"
id = "00000000-0000-4000-8000-000000000005"
[[bws.secrets]]
env = "LAB_FOXTROT_API_KEY"
id = "00000000-0000-4000-8000-000000000006"
[[bws.secrets]]
env = "LAB_GOLF_API_KEY"
id = "00000000-0000-4000-8000-000000000007"
# One value under two names, exactly as ZAI_API_KEY aliases Z_AI_API_KEY. This
# is why the real machine has 7 secrets and 8 exports.
[[bws.aliases]]
name = "LAB_GOLF_ALIAS_KEY"
from = "LAB_GOLF_API_KEY"
-97
View File
@@ -1,97 +0,0 @@
# .chezmoiignore -- PRIVATE tier.
#
# This is gitignore syntax. A `#` in the middle of a line becomes part of the
# pattern, silently producing an entry that matches nothing, so every comment
# in this file is on its own line. Learned in phase 1; it does not announce
# itself.
#
# Ignoring changes what chezmoi manages. It never removes or modifies a file
# on any machine.
# Repo documentation and the endpoint artifact, not dotfiles. Without these
# they land as ~/README.md and ~/bootstrap.env.example.
README.md
bootstrap.env.example
# Agent instructions for working IN this repo (the test-isolation rule), not a
# dotfile. Without this entry it lands as ~/CLAUDE.md, which Claude Code then
# loads into every session under $HOME. .claude/ and .design/ need no entry:
# chezmoi skips every dot-prefixed source name except .chezmoi*.
CLAUDE.md
# Runbook scripts for the bootstrap endpoint. Operator tooling that is run by
# hand a few times a year, not configuration that belongs in a home directory.
# They live here rather than in the public tier because they name the endpoint
# host and route, and the public repo is cloneable by strangers.
ops
ops/**
# chezmoi's own config directory. Never manage the thing that configures the
# manager.
.config/chezmoi
.config/chezmoi/**
# Nested git checkouts.
**/.git
**/.git/**
# Generated at apply time by run_after_50-secrets.sh, never tracked anywhere.
# If this line is ever removed, `chezmoi add` on a finished machine sweeps the
# six API keys straight into the repo.
.config/zsh/secrets.zsh
# The per-machine delta that Q5 puts opposite the base settings.json below.
# Claude Code writes this one; chezmoi must never fight it.
.claude/settings.local.json
.claude.json
# `bws` writes a 600-mode state cache here on its first successful call --
# ~/.config/bws/state/<uuid>, about 2 KB. It is derived from the access token
# and belongs in no repository. Found by watching what appeared in a throwaway
# home directory after the first apply, not by reading the documentation.
.config/bws
.config/bws/**
# The bws access token itself. `dotup` writes this from the bootstrap endpoint
# before this repo is even cloned, so chezmoi has no business managing it: a
# managed copy would overwrite a freshly-rotated token with a stale committed
# one on the next apply. It was committed exactly once, in phase 4, by a
# `chezmoi add` of the live file. Listing it here makes chezmoi decline the
# same `add` rather than accept it silently.
.config/bitwarden
.config/bitwarden/**
# ---------------------------------------------------------------- ssh ---
# Deny-by-default, then name the three things that travel. Q3 is answered as
# "sync public keys, not private": public keys are not secret, private keys
# never cross a network and are generated per machine.
#
# The wildcard is the point. An id_ed25519 generated on this machine tomorrow
# matches `.ssh/*` and is matched by no negation below, so `chezmoi add ~/.ssh`
# cannot sweep it up. New key files are excluded by default rather than
# remembered about.
#
# ~/.ssh/known_hosts is excluded by the same rule, deliberately: it is a log of
# where this machine has been, it rewrites itself constantly, and syncing it
# would make `chezmoi status` permanently dirty.
#
# NOTE THE ABSENCE of `!.ssh/*.pub`. Public keys do travel -- that is what
# ~/.ssh/pubkeys/ is for -- but NOT at ~/.ssh/id_ed25519.pub, and the
# distinction is not pedantry:
#
# Every machine generates its own keypair. If this tier also wrote
# id_ed25519.pub, that machine would end up with ITS private key sitting
# next to SOMEONE ELSE'S public key under the matching name. `ssh-copy-id`
# and every agent-only auth path read the .pub, so you would authorise the
# wrong machine and watch it appear to work.
#
# The practical value of syncing public keys is authorized_keys -- a new box
# accepting the keys you already have, with nothing to paste. That is carried
# in full. ~/.ssh/pubkeys/*.pub is the archive of the keys you own, for pasting
# into GitHub and Gitea, parked where ssh will never mistake one for the local
# identity.
.ssh/*
!.ssh/config
!.ssh/authorized_keys
!.ssh/pubkeys
!.ssh/pubkeys/*.pub
@@ -1 +0,0 @@
{}
@@ -1,230 +0,0 @@
#!/bin/sh
# dotsecrets -- regenerate ~/.config/zsh/secrets.zsh from Bitwarden Secrets Manager.
#
# Needs no endpoint, no username and no password. The bootstrap exchange already
# happened; what it left behind is ~/.config/bitwarden/bws-token, mode 600, and
# that token is the whole input to this command. Run it whenever you rotate a
# key in bws. `cmp apply` runs it too, via run_after_50-secrets.sh.
#
# THE ONE INVARIANT: a failed or partial fetch leaves a working secrets.zsh
# exactly as it was. Every value is fetched into a 600-mode temp file first,
# and that file is renamed over the real one only after all of them have
# arrived. Five keys out of six is a machine that was fine a moment ago and
# now silently cannot reach one provider -- worse than a machine that says the
# refresh failed and carries on with yesterday's keys.
#
# The temp file is created in the SAME DIRECTORY as the destination, not in
# /tmp. `mv` across filesystems is copy-then-unlink, which has a window where
# the destination is half-written; within one filesystem it is rename(2), which
# has none. The atomicity this whole script is built around is a property of
# rename(2), not of the word "mv".
#
# NOTHING IS EVER PRINTED. No value reaches stdout, stderr, argv or a log:
# - values move from `bws` into a shell variable and from there into a file
# through the `printf` BUILTIN, so they never appear in `ps`;
# - bws's own stderr is discarded, because an error message is not worth the
# risk of it quoting what it was handed;
# - every failure message below names the ENV VAR, never the value.
#
# Generated by chezmoi from the PRIVATE tier. The env-var -> secret-id map is
# .chezmoidata/bws.toml; UUIDs are identifiers, not secrets.
set -u
PROG=dotsecrets
CFG="${XDG_CONFIG_HOME:-$HOME/.config}"
TOKEN_FILE="$CFG/bitwarden/bws-token"
OUT="$CFG/zsh/secrets.zsh"
TMP=""
warn() { printf '%s: %s\n' "$PROG" "$*" >&2; }
cleanup() { [ -n "$TMP" ] && rm -f "$TMP"; return 0; }
trap cleanup EXIT
trap 'cleanup; exit 130' INT
trap 'cleanup; exit 143' TERM HUP
# Bail out without touching OUT. This is the entire point of the command.
abort() {
warn "$1"
if [ -r "$OUT" ]; then
warn "keeping the existing $OUT -- it was NOT modified"
else
warn "$OUT was not written; the shell starts without those keys"
fi
exit 1
}
# POSIX single-quoting using builtins only, so a value never becomes an
# argument to an external command and never becomes a line in `ps` output.
# API keys do not contain apostrophes, but a quoting routine that is correct
# only for the inputs you happen to have is not a quoting routine.
shquote() {
_sq_s=$1
_sq_o=''
while :; do
case $_sq_s in
*"'"*) ;;
*) break ;;
esac
_sq_o="$_sq_o${_sq_s%%\'*}'\\''"
_sq_s=${_sq_s#*\'}
done
printf "'%s%s'" "$_sq_o" "$_sq_s"
}
# ------------------------------------------------------------ preconditions ---
[ -r "$TOKEN_FILE" ] || abort "no bws token at $TOKEN_FILE (public-only machine?)"
# dotup installs bws into ~/.local/bin, and the very first run arrives from
# the pre-login shell where ~/.local/bin is NOT on PATH yet -- the same
# fresh-box quirk the public README documents for dotup itself. Without this
# probe the first apply of a brand-new machine silently ends with no
# secrets.zsh (found live 2026-08-22, phase 5 VM).
command -v bws >/dev/null 2>&1 || PATH="$HOME/.local/bin:$PATH"
command -v bws >/dev/null 2>&1 \
|| abort "bws is not installed or not on PATH -- https://bitwarden.com/help/secrets-manager-cli/"
BWS_ACCESS_TOKEN="$(cat "$TOKEN_FILE")"
[ -n "$BWS_ACCESS_TOKEN" ] || abort "$TOKEN_FILE is empty"
export BWS_ACCESS_TOKEN
mkdir -p "$CFG/zsh" || abort "cannot create $CFG/zsh"
chmod 700 "$CFG/zsh" 2>/dev/null || :
# ---------------------------------------------------------------- the map ---
# `env var name` `bws secret id`, rendered from .chezmoidata/bws.toml so that a
# UUID is written down in exactly one place and it is not this script.
SECRET_MAP='{{ range .bws.secrets }}
{{ .env }} {{ .id }}{{ end }}'
# Second names for a value fetched once. One secret, two exported names: some
# tools spell it Z_AI_API_KEY and some spell it ZAI_API_KEY.
ALIAS_MAP='{{ range .bws.aliases }}
{{ .name }} {{ .from }}{{ end }}'
# ------------------------------------------------------------- the fetch ---
umask 077
TMP="$(mktemp "$CFG/zsh/.secrets.zsh.XXXXXXXX")" || abort "cannot create a temp file beside $OUT"
chmod 600 "$TMP" || abort "cannot chmod the temp file"
{
printf '# Generated from Bitwarden Secrets Manager. DO NOT EDIT, DO NOT COMMIT.\n'
printf '# Regenerate with `dotsecrets`. Mode 600, in no repository.\n'
printf '# Last refreshed: %s\n\n' "$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
} >"$TMP" || abort "cannot write to the temp file"
# `set -f` because the maps are split on IFS by `set --`, and an unglobbed
# split would let a stray `*` in the source data expand against the cwd.
# The loops run in this shell, not in a pipeline subshell, so `count` and the
# remembered values survive them -- a `while read` on the right of a pipe is
# the classic way to lose exactly the state this script needs.
set -f
count=0
NL="$(printf '\n_')"
NL=${NL%_}
# shellcheck disable=SC2086
set -- $SECRET_MAP
while [ "$#" -ge 2 ]; do
name=$1
id=$2
shift 2
# The name becomes part of a variable name below. It comes from a file in
# this repo rather than from anywhere a stranger can reach, but a shell
# variable name is close enough to code that it gets checked anyway.
case $name in
[A-Za-z_]*) ;;
*) abort "invalid env var name in the secret map: $name" ;;
esac
case $name in
*[!A-Za-z0-9_]*) abort "invalid env var name in the secret map: $name" ;;
esac
# -o env prints `KEY=VALUE`, where KEY is the secret's own name in bws.
# Comparing it to the name we asked for is a free integrity check on the
# map: an id that points GEMINI_API_KEY at the Groq secret is caught here
# rather than six months later as a confusing 401.
line="$(bws secret get "$id" -o env 2>/dev/null)" \
|| abort "could not fetch $name from bws (no network, or the token is wrong or revoked)"
# First line only, trimmed with parameter expansion rather than `head` or
# `sed`: keeping the value out of every external process's stdin as well
# as its argv costs one case statement.
case $line in
*"$NL"*) line=${line%%"$NL"*} ;;
esac
case $line in
"$name"=*) ;;
*) abort "bws returned a different secret than $name -- check its id in .chezmoidata/bws.toml" ;;
esac
value=${line#"$name"=}
# Newer bws releases wrap the value in double quotes in `-o env` output;
# the versions on the existing machines did not. Strip exactly one
# symmetric pair, or every consumer gets a key with literal quotes in it
# and a 401 that looks like a rotated credential (found live 2026-08-22,
# phase 5 VM -- the fake bws in the tests does not quote, so only a real
# fresh install could surface it).
case $value in
\"*\") value=${value#\"}; value=${value%\"} ;;
esac
[ -n "$value" ] || abort "bws returned an empty value for $name"
printf 'export %s=%s\n' "$name" "$(shquote "$value")" >>"$TMP" \
|| abort "cannot write to the temp file"
# Remember it for the alias pass. The value is expanded by the assignment,
# not by `eval` -- eval only ever parses the variable NAME.
eval "_v_$name=\$value"
count=$((count + 1))
done
[ "$count" -gt 0 ] || abort ".chezmoidata/bws.toml carries no entries -- nothing to fetch"
# --------------------------------------------------------------- aliases ---
# After the loop, so an alias can only reference a value that has already
# arrived intact.
alias_count=0
# shellcheck disable=SC2086
set -- $ALIAS_MAP
while [ "$#" -ge 2 ]; do
alias_name=$1
source_name=$2
shift 2
alias_count=$((alias_count + 1))
eval "aliased=\${_v_$source_name:-}"
[ -n "$aliased" ] \
|| abort "alias $alias_name names $source_name, which is not in the secret map"
printf '\n# same value, second name expected by some tools\n' >>"$TMP" \
|| abort "cannot write to the temp file"
printf 'export %s=%s\n' "$alias_name" "$(shquote "$aliased")" >>"$TMP" \
|| abort "cannot write to the temp file"
done
set +f
# ----------------------------------------------------------------- commit ---
# Everything arrived. Only now does the real file change, and it changes in one
# rename rather than a truncate followed by a write.
chmod 600 "$TMP" || abort "cannot chmod the temp file"
mv -f "$TMP" "$OUT" || abort "cannot rename the temp file into place"
TMP=""
# $count is secrets FETCHED; aliases add further exports without another
# fetch. Reporting only the first number against a file with more lines than
# that reads like a bug in the generator. Say both.
if [ "$alias_count" -gt 0 ]; then
warn "wrote $OUT ($count secrets + $alias_count alias(es) = $((count + alias_count)) exports, mode 600)"
else
warn "wrote $OUT ($count secrets, mode 600)"
fi
exit 0
@@ -1,71 +0,0 @@
{{- $name := get . "gitName" -}}
{{- $email := get . "gitEmail" -}}
{{- $signing := get . "gitSigningKey" -}}
{{- $wan := get . "giteaWanSsh" -}}
{{- $lan := get . "giteaLanSsh" -}}
; ~/.config/git/config.local -- PRIVATE tier.
;
; The other half of the seam. ~/.gitconfig comes from the public repo, carries
; no [user], and ends with `[include] path = ~/.config/git/config.local`. Git
; treats a missing include as a no-op, so a public-only machine reads the
; public half and stops -- and `git commit` correctly refuses to guess who you
; are.
;
; Everything here is identity, not configuration: it is the answer to "whose
; machine is this", which is exactly the question the public tier must not be
; able to answer.
;
; Values come from the [data] prompts in .chezmoi.toml.tmpl, asked once at
; `chezmoi init`. Re-answer them with `cmp init` (see README).
{{ if and $name $email -}}
[user]
name = {{ $name }}
email = {{ $email }}
{{- if $signing }}
signingkey = {{ $signing }}
[commit]
gpgsign = true
[tag]
gpgsign = true
{{- end }}
{{- else -}}
; NO IDENTITY CONFIGURED.
;
; gitName and/or gitEmail are empty in the chezmoi config, which means either
; you pressed enter through the prompts or something overwrote
; ~/.config/chezmoi/chezmoi.toml after this tier was initialised. Re-run:
;
; chezmoi init -S ~/.local/share/dotfiles-private
;
; Until then git will refuse to commit, which is the correct complaint.
{{- end }}
; Every remote in every repo you own is ssh. This rewrite is what lets a
; copy-pasted https:// GitHub URL clone over the key you actually have, which
; matters most on a machine built ten minutes ago. It lived in the old
; dot_gitconfig; phase 3 removed it from the public tier because it names an
; authentication method tied to your keys, not a neutral default.
[url "git@github.com:"]
pushInsteadOf = https://github.com/
{{ if $wan -}}
; Gitea clone/push shortcuts: git clone gitea:ben/repo.git
[url "{{ $wan }}"]
insteadOf = gitea:
{{ end -}}
{{ if $lan -}}
[url "{{ $lan }}"]
insteadOf = gitea-lan:
{{ end }}
{{- if and $wan $lan }}
[alias]
; Configure `origin` to push to BOTH gitea servers at once. Run once inside
; a repo whose origin points at either gitea host:
;
; git dual-gitea
;
; After this, `git push` writes to WAN + LAN simultaneously. Fetch/pull
; continues to use origin's existing fetch URL.
dual-gitea = "!f() { url=$(git remote get-url origin) || { echo 'no origin remote' >&2; return 1; }; p=${url#gitea:}; p=${p#gitea-lan:}; p=${p#{{ $wan }}}; p=${p#{{ $lan }}}; if [ \"$p\" = \"$url\" ]; then echo \"origin is not a gitea remote: $url\" >&2; return 1; fi; git config --unset-all remote.origin.pushurl 2>/dev/null; git remote set-url --add --push origin \"gitea:$p\"; git remote set-url --add --push origin \"gitea-lan:$p\"; echo 'Dual-push configured on origin:'; git remote -v; }; f"
{{- end }}
@@ -1,69 +0,0 @@
{{- $wanWeb := get . "giteaWanWeb" -}}
{{- $lanWeb := get . "giteaLanWeb" -}}
# ~/.config/zsh/local.zsh -- PRIVATE tier. Mode 600.
#
# Sourced by the public ~/.zshrc, guarded, near the end:
#
# [[ -r ${XDG_CONFIG_HOME:-$HOME/.config}/zsh/local.zsh ]] && source ...
#
# Absent on a public-only machine, where the guard makes it a silent no-op.
# `_mac` and `_open` from .zshrc are still in scope by the time this runs, so
# an alias moved here needs no rewriting.
#
# What belongs here: anything that names a host you own. Nothing that is a
# secret -- those come from ~/.config/zsh/secrets.zsh, written by `dotsecrets`
# and carried in no repository at all.
#
# Mode 600 rather than 644, for the same reason .zshrc and .zshenv are: this is
# code your login shell executes, and a group-writable copy of it is arbitrary
# code execution for anyone in your primary group.
# --------------------------------------------------------------- gitea ---
# The web UI. The WAN host is a real name behind TLS; the LAN one is a bare
# address on a port, reachable only from the house, which is precisely why it
# cannot live in the public tier.
{{ if $wanWeb }}alias gitea='_open {{ $wanWeb }}'{{ end }}
{{ if $lanWeb }}alias gitea-lan='_open {{ $lanWeb }}'{{ end }}
# The clone/push shortcuts are git-side, not shell-side: `gitea:` and
# `gitea-lan:` are url.insteadOf rewrites in ~/.config/git/config.local, so
# `git clone gitea:ben/repo.git` works from any shell, not just this one.
# ------------------------------------------------------------- chezmoi ---
# Two instances, one home directory. The public tier lays the base; the private
# tier overlays identity on top. Both are ordinary chezmoi invocations with a
# different --source, so every subcommand you know still works:
#
# cm status / cm diff / cm re-add ~/.zshrc public
# cmp status / cmp diff / cmp apply private
#
# Each tier has its own source AND its own config file:
#
# public `chezmoi init --apply <url>`, no flags -> ~/.local/share/chezmoi
# ~/.config/chezmoi/chezmoi.toml
# private dotup, --source ... -c .../private.toml -> ~/.local/share/dotfiles-private
# ~/.config/chezmoi/private.toml
# ~/.config/chezmoi/chezmoistate-private.boltdb
#
# The -c is not cosmetic. Both tiers used to render their .chezmoi.toml.tmpl to
# the same default path, so re-running the PUBLIC installer overwrote the config
# holding this tier's seven promptStringOnce answers -- name, email, signing key,
# the gitea addresses -- and they were gone. Silently: the templates degrade
# politely when their data is missing, so the first symptom was `git commit` not
# knowing who you are, days later and unconnected to the install that caused it.
#
# The --persistent-state is the same lesson for chezmoi's state file: shared, each
# tier overwrote the other's config-template hash, and the public tier warned
# "config file template has changed" after every private command. private.toml
# names this file too, but `cmp init` opens the state before it rewrites that, so
# the alias has to carry it.
#
# -S, -c and --persistent-state must stay in step with dotup's PRIV_SRC, PRIV_CFG
# and PRIV_STATE. If you move one, move the others, or cmp reads a config that
# describes a different source tree.
alias cm='chezmoi'
alias cmp='chezmoi -S ${XDG_DATA_HOME:-$HOME/.local/share}/dotfiles-private -c ${XDG_CONFIG_HOME:-$HOME/.config}/chezmoi/private.toml --persistent-state ${XDG_CONFIG_HOME:-$HOME/.config}/chezmoi/chezmoistate-private.boltdb'
# Refresh ~/.config/zsh/secrets.zsh from Bitwarden Secrets Manager on demand.
# `cmp apply` does the same thing via run_after_50-secrets.sh.
# dotsecrets
@@ -1 +0,0 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBNye8EHJ7ijGBNbmvvY2DqzZ8pd88vlI4OOYcM7ZxBK lab@example.invalid
@@ -1,57 +0,0 @@
{{- $wan := get . "giteaWanSsh" | trimPrefix "ssh://git@" | trimSuffix "/" -}}
{{- $lan := get . "giteaLanSsh" | trimPrefix "ssh://git@" | trimSuffix "/" -}}
{{- $wanParts := $wan | splitList ":" -}}
{{- $lanParts := $lan | splitList ":" -}}
{{- $wanHost := $wanParts | first -}}
{{- $lanHost := $lanParts | first -}}
{{- $wanPort := ternary ($wanParts | last) "22" (gt (len $wanParts) 1) -}}
{{- $lanPort := ternary ($lanParts | last) "22" (gt (len $lanParts) 1) -}}
# ~/.ssh/config -- PRIVATE tier. Mode 600.
#
# HOST ALIASES ONLY. No key material of any kind travels in this repository,
# in this tier or any other. Q3 is answered "sync public keys, not private":
#
# travels ~/.ssh/config, ~/.ssh/authorized_keys, ~/.ssh/pubkeys/*.pub
# never id_ed25519, id_rsa, *.pem, anything without a .pub suffix
#
# The IdentityFile lines below name a key this machine generates for itself:
#
# ssh-keygen -t ed25519 -C "$(whoami)@$(hostname)"
#
# then paste ~/.ssh/id_ed25519.pub into GitHub and Gitea once. Ninety seconds
# per machine, and a private key never crosses a network. .chezmoiignore denies
# everything under .ssh/ by default and re-includes exactly three things, so a
# key generated tomorrow cannot be swept in by a careless `chezmoi add ~/.ssh`.
Host *
AddKeysToAgent yes
ServerAliveInterval 60
ServerAliveCountMax 3
HashKnownHosts no
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519
IdentitiesOnly yes
{{ if $wanHost }}
# Gitea over the WAN. A real hostname behind a real certificate; reachable
# from any network, which is what makes it the primary for both repos.
Host gitea {{ $wanHost }}
HostName {{ $wanHost }}
Port {{ $wanPort }}
User git
IdentityFile ~/.ssh/id_ed25519
IdentitiesOnly yes
{{ end }}
{{- if $lanHost }}
# The same Gitea, reached over the LAN on a different port. Faster at home and
# the only route if the WAN name is down. A bare address on a private network:
# the single most obviously non-public line in this whole system.
Host gitea-lan {{ $lanHost }}
HostName {{ $lanHost }}
Port {{ $lanPort }}
User git
IdentityFile ~/.ssh/id_ed25519
IdentitiesOnly yes
{{ end }}
@@ -1 +0,0 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBNye8EHJ7ijGBNbmvvY2DqzZ8pd88vlI4OOYcM7ZxBK lab@example.invalid
@@ -1,44 +0,0 @@
#!/bin/sh
# run_after_50-secrets.sh -- PRIVATE tier.
#
# Regenerate ~/.config/zsh/secrets.zsh at the end of every `cmp apply`.
#
# The `run_after_` prefix is load-bearing. It guarantees this runs once every
# managed file is on disk, which resolves the deadlock the old repo had: the
# old .zshrc fetched secrets on line 62 using a token that line 58's file had
# not written yet. Ordering by prefix rather than by hope.
#
# This script is a wrapper and nothing else. The work lives in `dotsecrets`,
# which you can also run by hand after rotating a key in bws -- one
# implementation, so the scheduled path and the manual path cannot drift apart
# and start disagreeing about what a valid secrets.zsh looks like.
#
# IT ALWAYS EXITS 0. A machine on a train with no signal must still be able to
# finish an apply. `dotsecrets` leaves an existing secrets.zsh untouched when
# it cannot fetch, so the failure mode here is "yesterday's keys and a warning"
# rather than "the apply died half way through".
set -u
{{ if ne .chezmoi.destDir .chezmoi.homeDir }}
# Rendered only when this apply is aimed somewhere other than the home
# directory -- `chezmoi apply --destination /tmp/whatever`, which is how this
# tier gets tested. `dotsecrets` resolves its own paths from $HOME, so running
# it here would reach straight past the throwaway destination and rewrite the
# real ~/.config/zsh/secrets.zsh. A test that mutates the machine it is
# protecting is not a test.
printf 'run_after_50-secrets: destination is {{ .chezmoi.destDir }}, not the home directory; skipping\n' >&2
exit 0
{{ end }}
DOTSECRETS="{{ .chezmoi.homeDir }}/.local/bin/dotsecrets"
if [ ! -x "$DOTSECRETS" ]; then
printf 'run_after_50-secrets: %s is missing or not executable; skipping\n' \
"$DOTSECRETS" >&2
exit 0
fi
if ! "$DOTSECRETS"; then
printf 'run_after_50-secrets: refresh failed (see above). The apply itself is fine.\n' >&2
fi
exit 0
-114
View File
@@ -1,114 +0,0 @@
#!/bin/bash
# Run one scenario against the working tree, in a container, offline.
#
# run.sh <scenario.sh> [--image IMG] [--keep] [--priv REPO]
#
# Everything the real system talks to is stood in locally: the bootstrap
# endpoint, both git remotes, and the secrets manager. Nothing here touches the
# real endpoint, the real repos, or the network, so a scenario can be run as
# often as it takes without publishing anything or spending a password.
#
# The code under test is the CURRENT WORKING TREE, committed or not.
set -euo pipefail
cd "$(dirname "$0")"
LAB=$PWD
PUB=$(CDPATH= cd -- ../.. && pwd)
PRIV_DEFAULT=$LAB/fake-private
scenario=""; IMAGE=dotup-lab:24.04; KEEP=0; PRIV=$PRIV_DEFAULT
while [ $# -gt 0 ]; do
case $1 in
--image) IMAGE=$2; shift 2 ;;
--keep) KEEP=1; shift ;;
--priv) PRIV=$2; shift 2 ;;
-*) echo "unknown flag $1" >&2; exit 2 ;;
*) scenario=$1; shift ;;
esac
done
[ -n "$scenario" ] || { echo "usage: run.sh <scenario.sh> [--image IMG] [--keep]" >&2; exit 2; }
[ -f "$scenario" ] || { echo "no such scenario: $scenario" >&2; exit 2; }
name=$(basename "$scenario" .sh)
# Distinct per run. The route and password are secrets in production, so the
# lab never reuses a value and never hardcodes one -- a scenario that only
# passes against a fixed password is testing the fixture.
rand() { head -c 18 /dev/urandom | od -An -tx1 | tr -d ' \n'; }
ROUTE=r-$(rand); PASS=$(rand); GIT_TOKEN=$(rand); USER_=ben
GW=$(docker network inspect bridge --format '{{range .IPAM.Config}}{{.Gateway}}{{end}}')
# Left unset so the server takes any free port and reports it back; several
# scenarios run at once and a fixed port makes them collide.
PORT=${LAB_PORT:-0}
ROOT=$(mktemp -d /tmp/dotup-lab.XXXXXX)
C=dotup-lab-$name-$$
cleanup() {
rc=$?
[ -n "${SRV:-}" ] && kill "$SRV" 2>/dev/null || :
if [ "$KEEP" = 1 ]; then
echo "kept: container $C lab root $ROOT" >&2
else
docker rm -f "$C" >/dev/null 2>&1 || :
rm -rf "$ROOT"
fi
exit $rc
}
trap cleanup EXIT INT TERM
echo "== lab: snapshotting working trees =="
sh snapshot.sh "$PUB" "$ROOT/git" dotfiles-public >/dev/null
sh snapshot.sh "$PRIV" "$ROOT/git" dotfiles-private >/dev/null
echo " public: $(git -C "$ROOT/git/dotfiles-public.git" ls-tree -r --name-only HEAD | wc -l) files"
echo " private: $(git -C "$ROOT/git/dotfiles-private.git" ls-tree -r --name-only HEAD | wc -l) files ($PRIV)"
export LAB_GIT_ROOT=$ROOT/git LAB_PORT=$PORT LAB_ROUTE=$ROUTE \
LAB_USER=$USER_ LAB_PASS=$PASS LAB_GIT_TOKEN=$GIT_TOKEN LAB_BIND=$GW
# The blob is byte-for-byte the shape the real endpoint returns: two KEY=VALUE
# lines, the repo URL carrying an inline token that the installer has to split
# out into a credential file.
# {PORT} is filled in by the server once it has bound one. The blob is
# otherwise byte-for-byte the shape the real endpoint returns: two KEY=VALUE
# lines, the repo URL carrying an inline token the installer must split out.
export LAB_BLOB="PRIVATE_REPO_URL=http://git:$GIT_TOKEN@$GW:{PORT}/git/dotfiles-private.git
BWS_ACCESS_TOKEN=lab-bws-$(rand)
"
python3 serve.py >"$ROOT/serve.log" 2>&1 & SRV=$!
for _ in $(seq 40); do
PORT=$(sed -n 's/^lab: listening on [^:]*:\([0-9]*\).*/\1/p' "$ROOT/serve.log")
[ -n "$PORT" ] && [ "$PORT" != 0 ] && break
sleep 0.25
done
[ -n "$PORT" ] && [ "$PORT" != 0 ] || { echo "lab server never reported a port:"; cat "$ROOT/serve.log"; exit 1; }
for _ in $(seq 40); do
curl -sf -o /dev/null -u "$USER_:$PASS" "http://$GW:$PORT/$ROUTE/bootstrap.env" && break
sleep 0.25
done
curl -sf -o /dev/null -u "$USER_:$PASS" "http://$GW:$PORT/$ROUTE/bootstrap.env" \
|| { echo "lab server never came up:"; cat "$ROOT/serve.log"; exit 1; }
echo " endpoint up on $GW:$PORT"
docker image inspect "$IMAGE" >/dev/null 2>&1 || {
echo "== lab: building $IMAGE =="; docker build -q -t "$IMAGE" -f Dockerfile . >/dev/null; }
docker rm -f "$C" >/dev/null 2>&1 || :
docker run -d --name "$C" --add-host lab:"$GW" "$IMAGE" >/dev/null
docker cp "$scenario" "$C:/tmp/scenario.sh" >/dev/null
[ -d assets ] && docker cp assets "$C:/tmp/assets" >/dev/null
echo "== lab: $name on $IMAGE =="
# Bare -e names inherit from this shell, so the password and the git token never
# appear in docker's argv -- /proc/<pid>/cmdline is world readable, which is the
# same hole this repo was fixed to stop opening.
export BOOT_URL="http://$GW:$PORT/$ROUTE" BOOT_USER=$USER_ BOOT_PW=$PASS \
PUB_URL="http://$GW:$PORT/git/dotfiles-public.git"
set +e
docker exec -u ben \
-e BOOT_URL -e BOOT_USER -e BOOT_PW -e PUB_URL \
-e HOME=/home/ben -e LANG=en_US.UTF-8 \
"$C" bash /tmp/scenario.sh
rc=$?
set -e
# Redact before anything is printed or kept: a scenario log that quoted the
# password back would be as bad as committing it.
sed -i -e "s|$PASS|<BOOT_PW>|g" -e "s|$GIT_TOKEN|<GIT_TOKEN>|g" -e "s|$ROUTE|<ROUTE>|g" \
"$ROOT/serve.log" 2>/dev/null || :
echo "== lab: $name exit $rc =="
exit $rc
-62
View File
@@ -1,62 +0,0 @@
#!/bin/bash
# Does the lab itself work? Clone the public tier from the local server exactly
# as the README's first command does, and prove the code that arrived is the
# working tree rather than whatever was last pushed.
set -u
fail() { echo "FAIL: $*"; exit 1; }
ok() { echo " ok $*"; }
echo "-- environment as handed to a real user --"
echo " user=$(id -un) uid=$(id -u) shell=$SHELL home=$HOME"
echo " PATH=$PATH"
case ":$PATH:" in *":$HOME/.local/bin:"*)
fail "~/.local/bin is already on PATH -- the box is not fresh, and the
'command not found' bug cannot reproduce here" ;;
esac
ok "~/.local/bin is NOT on PATH yet (matches a real fresh login)"
command -v git >/dev/null && fail "git pre-installed -- image is too generous"
ok "git absent, as on a stock image"
echo "-- the documented first command --"
# ISSUE-1 regression guard: NOTHING is installed by hand here. git is absent,
# and the documented command has to cope with that on its own. If this scenario
# ever needs an `apt-get install git` again, the front door has re-broken.
sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply "$PUB_URL" >/tmp/init.log 2>&1 \
|| { tail -20 /tmp/init.log; fail "chezmoi init --apply"; }
ok "public tier applied — from a box with no git, unaided"
grep -q 'installing git' /tmp/init.log \
|| fail "git was installed, but not by run_before_00-require-git.sh —
something else is satisfying the prerequisite and the fix is untested"
ok "run_before_00-require-git.sh is what supplied git"
command -v git >/dev/null || fail "git still missing after the apply"
n=$(ls -d "$HOME/.oh-my-zsh" "$HOME/.tmux" 2>/dev/null | wc -l)
[ "$n" -eq 2 ] || fail "the git-repo externals did not clone ($n/2 present)"
ok "the six git-repo externals cloned"
[ -x "$HOME/.local/bin/dotup" ] || fail "no executable at ~/.local/bin/dotup"
ok "dotup landed at ~/.local/bin/dotup"
# The whole point of the lab: prove we are running uncommitted code. The
# snapshot commit message is the marker, and it cannot exist on any real remote.
src=$(~/bin/chezmoi source-path 2>/dev/null || chezmoi source-path 2>/dev/null || echo "$HOME/.local/share/chezmoi")
msg=$(git -C "$src" log -1 --format=%s 2>/dev/null || echo none)
case $msg in
"working-tree snapshot of dotfiles-public") ok "serving the WORKING TREE, not a pushed commit" ;;
*) fail "expected the working-tree snapshot commit, got: $msg" ;;
esac
echo "-- and the bug, reproduced --"
if command -v dotup >/dev/null 2>&1; then
fail "bare 'dotup' resolved in this shell -- expected 'command not found'"
fi
ok "bare 'dotup' is command-not-found in the shell that ran the install"
if bash -lc 'command -v dotup' >/dev/null 2>&1; then
ok "a NEW login shell does resolve it (~/.profile picks up ~/.local/bin)"
grep -q 'Next: ~/.local/bin/dotup' /tmp/init.log \
|| fail "the install never told the user what to run next, so the only
way to find out is to type 'dotup' and be told it does not exist"
ok "the install printed the absolute path to run next, and why"
else
fail "even a new login shell cannot find dotup"
fi
echo "SMOKE PASS"
-310
View File
@@ -1,310 +0,0 @@
#!/bin/bash
# What a real user actually gets.
#
# The picker's ^a is `preset defaults`, and Enter is `install`. This scenario is
# that keystroke pair with nobody at the keyboard: tick the defaults, resolve
# every ticked row through dotup's own `resolve`, run dotup's own installer, and
# then ask the machine -- not the log -- whether each package is there.
#
# The log is not evidence. `apt-get install -y` prints a great deal and still
# leaves you without the package; a batch that fails silently retries one at a
# time and the second failure scrolls past the first. So every row is verified
# against the filesystem or the package database afterwards, and anything that
# did not land is RE-RUN ON ITS OWN through dotup, which does three things at
# once: it gets the exact command dotup would use, the exact exit code, and the
# exact first line of the error, with no other package's output interleaved.
#
# The re-run also settles the question a single pass cannot: a package that
# fails in the batch and installs on its own was a flake or a batch fault, not
# an unavailable package. Those come back as FLAKE-RECOVERED and are reported
# separately, so a transient 503 from a mirror is never filed as a bug.
#
# Output: a tab-separated table on stdout, one row per selected package.
# STATUS KEY CHANNEL ARG ISORC ERROR
set -u
fail() { echo "FAIL: $*"; exit 1; }
ok() { echo " ok $*"; }
STATE=$HOME/.config/dotfiles
SEL=$STATE/selected
DOTUP=$HOME/.local/bin/dotup
LOG=/tmp/dotup-lab
mkdir -p "$LOG"
# ------------------------------------------------------------------ preamble -
echo "-- preamble --"
# ISSUE-1: the documented one-liner used to die on a stock box, because chezmoi's
# six git-repo externals need git and the image has none. Try it UNAIDED first --
# if the repo now supplies git itself, installing it here would hide that and
# hide any future regression. Only fall back to the hand-install, loudly, if the
# documented command still cannot stand on its own.
if sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply "$PUB_URL" >"$LOG/init.log" 2>&1; then
if grep -q 'installing git' "$LOG/init.log"; then
ok "ISSUE-1 fixed upstream: the repo installed git itself"
else
ok "chezmoi init --apply succeeded (git was already satisfied)"
fi
else
echo " NOTE ISSUE-1 still open: init --apply failed on a box with no git"
sudo apt-get update -qq >/dev/null 2>&1
sudo apt-get install -y -qq git >/dev/null 2>&1 || fail "could not install git"
echo " NOTE installed git by hand and retried -- see ISSUE-1"
sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply "$PUB_URL" >"$LOG/init.log" 2>&1 \
|| { tail -20 "$LOG/init.log"; fail "chezmoi init --apply"; }
fi
[ -x "$DOTUP" ] || fail "no dotup at $DOTUP"
ok "public tier applied; dotup at $DOTUP"
# The tree under test moves while this suite is being written, so pin which
# build produced the table below. Two runs that disagree are only interesting
# if they ran the same code.
echo " dotup sha256 $(sha256sum "$DOTUP" | cut -c1-16) manifest sha256 $(sha256sum "$HOME/.local/share/dotup/packages.tsv" | cut -c1-16)"
# A user on a desktop has a display, and `preset defaults` ticks the gui rows
# only when one is present -- so ^a on a headless box selects a DIFFERENT set.
# Say which of the two we are testing instead of inheriting whatever the
# container happens to be.
export DISPLAY=:99
# --------------------------------------------------------------- selection --
echo "-- selection: ^a (preset defaults) --"
"$DOTUP" preset defaults || fail "preset defaults"
nsel=$(grep -c . "$SEL")
nsafe=$(awk -F'\t' '!/^[#@]/ && NF>=3 && $3=="safe"' "$HOME/.local/share/dotup/packages.tsv" | wc -l)
ngui=$(awk -F'\t' '!/^[#@]/ && NF>=3 && $3=="gui"' "$HOME/.local/share/dotup/packages.tsv" | wc -l)
echo " manifest: safe=$nsafe gui=$ngui -> expected $((nsafe + ngui))"
echo " selected: $nsel"
[ "$nsel" -eq $((nsafe + ngui)) ] || fail "defaults preset did not tick safe+gui"
ok "$nsel packages ticked"
# -------------------------------------------------------------- resolution --
# dotup's own resolver, one key at a time, so the table below is what dotup
# decided rather than what this scenario guessed.
echo "-- resolution (dotup resolve) --"
: > "$LOG/resolved.tsv"
while read -r key; do
[ -n "$key" ] || continue
line=$("$DOTUP" resolve "$key" 2>/dev/null)
IFS=$'\t' read -r ch arg <<<"$line"
[ -n "${arg:-}" ] || arg="-"
printf '%s\t%s\t%s\n' "$key" "${ch:-?}" "$arg" >> "$LOG/resolved.tsv"
done < "$SEL"
echo " channel spread:"
awk -F'\t' '{c[$2]++} END{for(k in c) printf " %-12s %d\n", k, c[k]}' "$LOG/resolved.tsv" | sort
"$DOTUP" plan >"$LOG/plan.log" 2>&1 || :
"$DOTUP" --print --yes install >"$LOG/print.log" 2>&1 || :
ok "plan and dry-run captured"
# ----------------------------------------------------------------- install --
echo "-- install: dotup --yes install (this takes a while) --"
t0=$(date +%s)
"$DOTUP" --yes install >"$LOG/install.log" 2>&1
irc=$?
t1=$(date +%s)
echo " exit $irc after $((t1 - t0))s, $(wc -l <"$LOG/install.log") lines of log"
echo "-- what dotup itself said did not install --"
sed -n '/did not install/,$p' "$LOG/install.log" | sed 's/\x1b\[[0-9;]*m//g' | sed 's/^/ | /'
# ------------------------------------------------------------ verification --
# Ask the machine, not the log.
UV=$(command -v uv 2>/dev/null || echo "$HOME/.local/bin/uv")
dpkg_ok() { [ "$(dpkg-query -W -f='${db:Status-Status}' "$1" 2>/dev/null)" = installed ]; }
# The same search path dotup's own find_tool uses, and for the same reason: a
# tool installed a moment ago is not on this process's PATH. Checking only PATH
# and ~/.local/bin reported chezmoi missing when get.chezmoi.io had put it in
# ~/bin -- a false failure against dotup for a fault in the check.
have_bin() {
local c
command -v "$1" >/dev/null 2>&1 && return 0
for c in "$HOME/.local/bin/$1" "$HOME/bin/$1" "$HOME/.npm-global/bin/$1" \
"/usr/local/bin/$1" "/usr/local/go/bin/$1" \
"/home/linuxbrew/.linuxbrew/bin/$1" "/opt/homebrew/bin/$1"; do
[ -x "$c" ] && return 0
done
return 1
}
npm_ok() {
local root
root=$(npm root -g 2>/dev/null) || return 1
[ -n "$root" ] && [ -e "$root/$1" ]
}
verify() {
local key=$1 ch=$2 arg=$3 n
# The bespoke channels land somewhere only their handler knows about.
case $key in
core/neovim) [ -x /opt/nvim/bin/nvim ]; return $? ;;
core/go) [ -x /usr/local/go/bin/go ]; return $? ;;
core/chezmoi) have_bin chezmoi; return $? ;;
core/uv) have_bin uv; return $? ;;
apps/chrome) dpkg_ok google-chrome-stable; return $? ;;
apps/ghostty) dpkg_ok ghostty; return $? ;;
esac
case $ch in
apt) for n in $arg; do dpkg_ok "$n" || return 1; done; return 0 ;;
brew) command -v brew >/dev/null 2>&1 || return 1
brew list --formula "$arg" >/dev/null 2>&1; return $? ;;
npm) for n in $arg; do npm_ok "$n" || return 1; done; return 0 ;;
uv) [ -x "$UV" ] || return 1
"$UV" tool list 2>/dev/null | grep -q "^$arg "; return $? ;;
# Both of these are bounded on purpose. `snap list` does not fail fast when
# snapd is installed but not running -- it blocks trying to reach a daemon
# systemd never started -- and a verification step that can hang forever is
# not a verification step.
snap) command -v snap >/dev/null 2>&1 || return 1
timeout 20 snap list "$arg" >/dev/null 2>&1; return $? ;;
flatpak) command -v flatpak >/dev/null 2>&1 || return 1
timeout 20 flatpak --user info "$arg" >/dev/null 2>&1 && return 0
timeout 20 flatpak info "$arg" >/dev/null 2>&1; return $? ;;
*) return 1 ;;
esac
}
# Re-run ONE key through dotup, with its own state directory so the selection is
# exactly that key. Everything -- resolution, channel dispatch, the command
# string, sudo -- is dotup's, so what comes back is dotup's behaviour for that
# package in isolation and not this scenario's reconstruction of it.
isolate() {
local key=$1 d rc
d=$(mktemp -d)
printf '%s\n' "$key" >"$d/selected"
: >"$d/expanded"
DOTUP_STATE=$d "$DOTUP" --yes install >"$LOG/iso.$(printf '%s' "$key" | tr / _).log" 2>&1
rc=$?
rm -rf "$d"
return $rc
}
isolog() { printf '%s/iso.%s.log' "$LOG" "$(printf '%s' "$1" | tr / _)"; }
# The first line that looks like a diagnosis, falling back to the last thing
# said. apt says "E:", npm says "npm error", brew and snap just say it.
firstline() {
local f=$1 l
l=$(sed 's/\x1b\[[0-9;]*m//g' "$f" 2>/dev/null \
| grep -m1 -aE 'E: |error|Error|ERROR|Unable to locate|not found|No such|Permission denied|refus|missing|unavailable|failed|Failed' )
[ -n "$l" ] || l=$(sed 's/\x1b\[[0-9;]*m//g' "$f" 2>/dev/null | grep -a . | tail -1)
printf '%s' "$l" | sed 's/^[[:space:]+]*//' | cut -c1-150
}
echo
echo "-- verification and per-package isolation --"
: > "$LOG/table.tsv"
while IFS=$'\t' read -r key ch arg; do
if verify "$key" "$ch" "$arg"; then
printf 'OK\t%s\t%s\t%s\t-\t-\n' "$key" "$ch" "$arg" >> "$LOG/table.tsv"
continue
fi
isolate "$key"; rc=$?
if verify "$key" "$ch" "$arg"; then
printf 'FLAKE-RECOVERED\t%s\t%s\t%s\t%s\t%s\n' \
"$key" "$ch" "$arg" "$rc" "$(firstline "$(isolog "$key")")" >> "$LOG/table.tsv"
else
printf 'FAIL\t%s\t%s\t%s\t%s\t%s\n' \
"$key" "$ch" "$arg" "$rc" "$(firstline "$(isolog "$key")")" >> "$LOG/table.tsv"
fi
done < "$LOG/resolved.tsv"
# --------------------------------------------------------------- the table --
echo
echo "===== RESULT TABLE ====="
printf 'STATUS\tKEY\tCHANNEL\tARG\tISORC\tERROR\n'
sort -k1,1r -k2,2 "$LOG/table.tsv"
echo "===== END RESULT TABLE ====="
echo
echo "===== COUNTS ====="
awk -F'\t' '{s[$1]++; if($1!="OK") c[$3]++} END{
for (k in s) printf "%-16s %d\n", k, s[k]
printf "\nfailures by channel:\n"
for (k in c) printf " %-10s %d\n", k, c[k] }' "$LOG/table.tsv"
printf 'total%12s %d\n' "" "$(grep -c . "$LOG/table.tsv")"
echo "===== END COUNTS ====="
echo
echo "===== RUNTIME SMOKE ====="
# Installed is not the same as usable, and the difference is not visible in any
# install log. apt's nodejs on 24.04 is 18.19.1; every npm row in this manifest
# declares node>=20. npm 9 only WARNS about a failed engine check, so the
# install exits 0 and leaves a tool that cannot start. A table that stopped at
# "the files are on disk" would score that as a success.
smoke() {
local b=$1 p="" c out rc first
shift
p=$(command -v "$b" 2>/dev/null) || p=""
if [ -z "$p" ]; then
for c in "$HOME/.local/bin/$b" "$HOME/bin/$b" "$HOME/.npm-global/bin/$b" \
"/usr/local/bin/$b" "/usr/local/go/bin/$b"; do
[ -x "$c" ] && { p=$c; break; }
done
fi
[ -n "$p" ] || { printf 'ABSENT\t%s\t-\t-\n' "$b"; return; }
out=$("$p" "$@" 2>&1); rc=$?
first=$(printf '%s' "$out" | sed 's/\x1b\[[0-9;]*m//g' | grep -a . | head -1 | cut -c1-110)
if [ "$rc" -eq 0 ]; then printf 'RUNS\t%s\t%s\t%s\n' "$b" "$rc" "$first"
else printf 'BROKEN\t%s\t%s\t%s\n' "$b" "$rc" "$first"; fi
}
printf 'STATUS\tBINARY\tRC\tFIRSTLINE\n'
smoke node --version
smoke npm --version
smoke nvim --version
smoke go version
smoke uv --version
smoke chezmoi --version
smoke rg --version
smoke fdfind --version
smoke batcat --version
smoke eza --version
smoke gh --version
smoke mmdc --version
smoke codex --version
smoke pi --version
smoke specify --help
smoke btop --version
smoke lazygit --version
smoke bw --version
echo "===== END RUNTIME SMOKE ====="
echo
echo "===== ISOLATION DETAIL (non-OK rows) ====="
awk -F'\t' '$1!="OK"{print $2}' "$LOG/table.tsv" | while read -r key; do
echo "--- $key ---"
sed 's/\x1b\[[0-9;]*m//g' "$(isolog "$key")" 2>/dev/null | grep -a . | tail -14 | sed 's/^/ /'
done
echo "===== END ISOLATION DETAIL ====="
echo
echo "===== DOTUP PLAN ====="
sed 's/\x1b\[[0-9;]*m//g' "$LOG/plan.log" | sed 's/^/ /'
echo "===== END DOTUP PLAN ====="
echo
echo "===== DRY RUN (dotup --print install) ====="
sed 's/\x1b\[[0-9;]*m//g' "$LOG/print.log" | sed 's/^/ /'
echo "===== END DRY RUN ====="
# A dry run reports what WOULD happen. It must never invent a failure that
# exists only because nothing ran. core/brew probed `have brew` after an
# install step that --print had merely printed, so a perfectly clean plan
# reported "brew still not found after installing it".
#
# This assertion has to live in a container. On a developer box `find_tool`
# probes /home/linuxbrew/.linuxbrew/bin by ABSOLUTE path and finds a real brew,
# so `have brew` succeeds and the bug cannot reproduce -- the same assertion in
# the fast suite passed with the guard deliberately removed.
invented=$(sed 's/\x1b\[[0-9;]*m//g' "$LOG/print.log" \
| sed -n '/did not install/,$p' | grep -E '^[[:space:]]+[a-z]+/[a-z]' || true)
if [ -n "$invented" ]; then
printf '%s\n' "$invented" | sed 's/^/ | /'
fail "the dry run reported failures for packages it never tried to install"
fi
ok "a dry run invents no failures"
nfail=$(awk -F'\t' '$1=="FAIL"' "$LOG/table.tsv" | wc -l)
echo
echo "MANIFEST-INSTALL: $nsel selected, $nfail did not install"
exit 0
-64
View File
@@ -1,64 +0,0 @@
#!/bin/bash
# The three packages with no apt source at all: lazygit, omp, herdr.
#
# They are `safe` and pre-ticked, they resolve to brew, and until now nothing
# installed brew -- so `^a` promised three packages that failed on every fresh
# Linux box. Homebrew does run on Linux; it just has to be asked.
#
# This is deliberately its own scenario. The Homebrew installer pulls a large
# tree and takes minutes, which is not something to bolt onto the fast path.
set -u
fail() { echo "FAIL: $*"; exit 1; }
ok() { echo " ok $*"; }
sudo apt-get update -qq && sudo apt-get install -y -qq git >/dev/null 2>&1
sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply "$PUB_URL" >/tmp/init.log 2>&1 \
|| { tail -5 /tmp/init.log; fail "public tier init"; }
D=$HOME/.local/bin/dotup
command -v brew >/dev/null && fail "brew already present — this box is not fresh"
ok "no brew on a stock box, which is the whole problem"
S=${XDG_CONFIG_HOME:-$HOME/.config}/dotfiles; mkdir -p "$S"
# Tick ONLY lazygit. brew must arrive through the @needs closure, not because
# the scenario asked for it -- that is the property under test.
"$D" preset none >/dev/null
"$D" toggle p:core/lazygit >/dev/null
grep -qx 'core/brew' "$S/selected" \
|| fail "ticking core/lazygit did not pull in core/brew — the @needs edge is missing"
ok "ticking lazygit pulled in core/brew by itself"
# Order matters as much as presence: core/brew is a `script` row, and script
# used to run AFTER brew, so brew would still have been missing when the three
# brew rows were attempted.
"$D" --print install 2>&1 | grep -n 'Homebrew/install\|brew install lazygit' > /tmp/order.txt
h=$(sed -n 's/^\([0-9]*\):.*Homebrew\/install.*/\1/p' /tmp/order.txt | head -1)
b=$(sed -n 's/^\([0-9]*\):.*brew install lazygit.*/\1/p' /tmp/order.txt | head -1)
[ -n "$h" ] && [ -n "$b" ] || fail "could not find both steps in the plan: $(cat /tmp/order.txt)"
[ "$h" -lt "$b" ] || fail "brew is installed AFTER the packages that need it (line $h vs $b)"
ok "the installer runs before the packages that need it"
echo "-- installing, this is the slow part --"
"$D" --yes install >/tmp/install.log 2>&1
rc=$?
tail -4 /tmp/install.log | sed 's/^/ | /'
[ "$rc" -eq 0 ] || fail "dotup install exited $rc"
command -v brew >/dev/null 2>&1 || [ -x /home/linuxbrew/.linuxbrew/bin/brew ] \
|| fail "brew was not installed"
ok "brew installed to the linuxbrew prefix"
export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"
# /usr/local is the reason Homebrew has a reputation. On Linux it should be
# untouched, and that claim is worth checking rather than repeating.
[ -z "$(ls -A /usr/local/bin 2>/dev/null | grep -x 'brew' || true)" ] \
|| fail "brew wrote into /usr/local/bin"
ok "/usr/local is untouched — everything is under the linuxbrew prefix"
command -v lazygit >/dev/null || fail "lazygit still not installed after brew arrived"
ok "lazygit installed: $(lazygit --version 2>&1 | head -1 | cut -c1-60)"
grep -q 'did not install' /tmp/install.log \
&& { grep -A5 'did not install' /tmp/install.log | sed 's/^/ | /'; fail "packages still failed"; }
ok "nothing in the run failed"
echo "BREW PASS"
File diff suppressed because it is too large. Load diff
-225
View File
@@ -1,225 +0,0 @@
#!/bin/bash
# The private tier, end to end, against a local stand-in for everything remote.
#
# Nothing here touches the real endpoint, the real repos or the real secrets
# manager, so it can be run as often as it takes and costs nothing when it
# fails. What it does exercise is the real code: dotup's prompt loop, the real
# credential splitting, chezmoi's real seven-question TUI, and the private
# tier's real `dotsecrets` -- copied verbatim into the fake source tree, so it
# is the shipping implementation being measured, not a rewrite of it.
#
# The first password is deliberately wrong. These credentials are asked for at
# the very end of a run, so before the retry loop existed one typo meant redoing
# the entire install. Getting it wrong on purpose is the only way to prove the
# recovery path is there and that the URL and username survive the mistake.
set -u
fail() { echo "FAIL: $*"; exit 1; }
ok() { echo " ok $*"; }
umask 022 # modes below assume it; do not let the daemon's umask decide
sudo apt-get update -qq && sudo apt-get install -y -qq git expect unzip >/dev/null 2>&1
echo " NOTE installed git by hand -- see ISSUE-1"
# ---- public tier first: the private tier is a continuation, never a start ----
sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply "$PUB_URL" >/tmp/init.log 2>&1 \
|| { tail -5 /tmp/init.log; fail "public tier init"; }
export PATH="$HOME/.local/bin:$HOME/bin:$PATH"
D=$HOME/.local/bin/dotup
[ -x "$D" ] || fail "no dotup after the public apply"
ok "public tier applied"
# absence assertions BEFORE the private tier exists, so their later presence
# means something
for f in "$HOME/.config/zsh/secrets.zsh" "$HOME/.config/bitwarden/bws-token" \
"$HOME/.local/share/dotfiles-private"; do
[ ! -e "$f" ] || fail "$f exists on a public-only machine"
done
ok "public-only machine carries no token, no secrets, no private source"
# ---- a fake bws, so nothing reaches the network -----------------------------
# `ensure_bws` checks `have bws` first and `have` searches ~/.local/bin, so
# putting the stub there is enough to keep the real download out of this run.
# The real ensure_bws (pin, checksum, musl target) is a separate scenario --
# faking it here would only prove the fake works.
mkdir -p "$HOME/.local/bin"
cat > "$HOME/.local/bin/bws" <<'BWS'
#!/bin/sh
# Stand-in for the Bitwarden Secrets Manager CLI. Answers exactly the call
# dotsecrets makes: `bws secret get <uuid> -o env`, printing KEY=VALUE.
# LAB_BWS_MODE bends it to drive the failure branches.
case "${LAB_BWS_MODE:-ok}" in
fail) exit 1 ;;
wrong) printf 'SOMETHING_ELSE=x\n'; exit 0 ;;
empty) printf 'LAB_ALPHA_API_KEY=\n'; exit 0 ;;
esac
[ "$1" = secret ] && [ "$2" = get ] || { echo "unsupported: $*" >&2; exit 2; }
case "$3" in
*0001) k=LAB_ALPHA_API_KEY ;; *0002) k=LAB_BRAVO_API_KEY ;;
*0003) k=LAB_CHARLIE_API_KEY ;; *0004) k=LAB_DELTA_API_KEY ;;
*0005) k=LAB_ECHO_API_KEY ;; *0006) k=LAB_FOXTROT_API_KEY ;;
*0007) k=LAB_GOLF_API_KEY ;; *) echo "unknown id $3" >&2; exit 1 ;;
esac
printf '%s=lab-value-for-%s\n' "$k" "$k"
BWS
chmod 755 "$HOME/.local/bin/bws"
ok "fake bws in place; this run reaches no network"
# ---- tick the private rows, as the picker would ------------------------------
S=${XDG_CONFIG_HOME:-$HOME/.config}/dotfiles
mkdir -p "$S"; printf 'private/private-repo\nprivate/bws-secrets\n' > "$S/selected"
# ---- drive it exactly as a person sitting at the keyboard would --------------
export E2E_NAME='Lab Tester' E2E_EMAIL='lab@example.invalid'
timeout 420 expect -f - >/tmp/private.log 2>&1 <<'EXP'
set timeout 120
log_user 1
spawn -noecho env PATH=$env(PATH) $env(HOME)/.local/bin/dotup private
# A bare `expect -re {pat} {}` treats a timeout as "carry on", so a missed
# prompt falls through silently and every later expect waits out its own
# timeout, surfacing much later as an unattributed hang. Name what was missed.
proc wait_for {pat what} {
expect {
-re $pat {}
timeout { send_user "\nTIMEOUT: never saw $what\n"; exit 3 }
eof { send_user "\nEOF before $what -- dotup exited early\n"; exit 4 }
}
}
# dotup's own three prompts are plain `read` in cooked mode, so the text is the
# whole signal.
wait_for {Bootstrap URL:} "the bootstrap URL prompt"
send -- "$env(BOOT_URL)\r"
wait_for {Username:} "the username prompt"
send -- "$env(BOOT_USER)\r"
wait_for {Password:} "the password prompt"
send -- "wrong-on-purpose\r"
wait_for {wrong username or password} "the 401 message naming the actual fault"
# The bracketed default is the proof that the URL and username were retained,
# so only the password has to be retyped.
wait_for {Bootstrap URL \[} "the retry prompt with the URL kept"
send -- "\r"
wait_for {Username \[} "the retry prompt with the username kept"
send -- "\r"
wait_for {Password:} "the retry password prompt"
send -- "$env(BOOT_PW)\r"
# chezmoi's seven are a full-screen TUI, and matching the prompt TEXT is not
# enough. chezmoi writes the prompt while the tty is still in cooked mode and
# only then switches to raw with TCSAFLUSH, which DISCARDS anything already
# buffered. An answer sent on the text alone can land in that window and be
# thrown away -- the field sits unsubmitted and the run burns its whole
# timeout. `\033[?2004h` is bracketed-paste-on, emitted only after raw mode is
# established, so waiting for it turns "probably ready" into "demonstrably
# ready". Each prompt emits its own.
proc ask {pat val} {
wait_for $pat "chezmoi prompt $pat"
wait_for "\033\\\[\\?2004h" "raw mode after $pat (the TUI never became ready)"
send -- "$val\r"
}
ask {user\.name} "$env(E2E_NAME)"
ask {user\.email} "$env(E2E_EMAIL)"
ask {signing key} ""
ask {WAN ssh} ""
ask {LAN ssh} ""
ask {WAN web} ""
ask {LAN web} ""
expect eof
catch wait result
exit [lindex $result 3]
EXP
rc=$?
red() { sed -e "s|$BOOT_PW|<BOOT_PW>|g" -e "s|$BOOT_URL|<BOOT_URL>|g"; }
case $rc in
124) red </tmp/private.log | tail -8 | sed 's/^/ /'
fail "hit the 420s ceiling -- expect wedged past its own handlers" ;;
3|4) red </tmp/private.log | tr -d '\r' | tail -8 | sed 's/^/ /'
fail "a prompt went unanswered -- the TIMEOUT/EOF line above names it" ;;
esac
red </tmp/private.log | tr -d '\r' | tail -6 | sed 's/^/ | /'
# ---- what must be true afterwards -------------------------------------------
echo "-- verification --"
m() { stat -c '%a' "$1" 2>/dev/null; }
[ -d "$HOME/.local/share/dotfiles-private" ] || fail "private source not cloned"
case $(m "$HOME/.local/share/dotfiles-private") in *00) ;; *)
fail "private source is mode $(m "$HOME/.local/share/dotfiles-private") — group/other can read it" ;; esac
ok "private source cloned, go-rwx"
[ "$(m "$HOME/.config/bitwarden/bws-token")" = 600 ] || fail "bws token mode $(m "$HOME/.config/bitwarden/bws-token"), want 600"
ok "bws token written, mode 600"
SEC=$HOME/.config/zsh/secrets.zsh
[ -r "$SEC" ] || fail "secrets.zsh not generated"
[ "$(m "$SEC")" = 600 ] || fail "secrets.zsh mode $(m "$SEC"), want 600"
n=$(grep -c '^export ' "$SEC")
[ "$n" -eq 8 ] || fail "secrets.zsh has $n exports, want 8 (7 secrets + 1 alias)"
grep -q '^export LAB_GOLF_ALIAS_KEY=' "$SEC" || fail "the alias export is missing"
ok "secrets.zsh mode 600, 8 exports, alias present"
for p in "$HOME/.config/zsh:700" "$HOME/.ssh:700" "$HOME/.ssh/config:600" \
"$HOME/.config/zsh/local.zsh:600" "$HOME/.local/bin/dotsecrets:700"; do
want=${p##*:}; path=${p%:*}
[ "$(m "$path")" = "$want" ] || fail "$path is mode $(m "$path"), want $want"
done
ok "every private destination carries the mode it claims"
# The credential must survive as a file and nowhere else.
CRED=${XDG_CONFIG_HOME:-$HOME/.config}/dotfiles/private-credentials
[ "$(m "$CRED")" = 600 ] || fail "credential file mode $(m "$CRED"), want 600"
GC=$HOME/.local/share/dotfiles-private/.git/config
grep -qE '://[^/@[:space:]]*:[^/@[:space:]]+@' "$GC" \
&& fail "the clone's .git/config still carries the token"
grep -qE '://[^/@[:space:]]*:[^/@[:space:]]+@' /tmp/private.log \
&& fail "a credential-bearing URL appears in dotup's own output"
ok "token is in the 600-mode credential file only — not in .git/config, not in the log"
git -C "$HOME/.local/share/dotfiles-private" fetch -q 2>/dev/null \
|| fail "a later fetch cannot authenticate — the credential helper did not survive"
ok "a later fetch still authenticates from that file"
# ---- the failure branches: yesterday's keys beat no keys --------------------
before=$(sha256sum "$SEC" | cut -d' ' -f1)
for mode in fail wrong empty; do
LAB_BWS_MODE=$mode "$HOME/.local/bin/dotsecrets" >/dev/null 2>&1
[ "$(sha256sum "$SEC" | cut -d' ' -f1)" = "$before" ] \
|| fail "bws mode '$mode' modified secrets.zsh — it must be left alone on failure"
done
ls "$HOME/.config/zsh"/.secrets.zsh.* >/dev/null 2>&1 && fail "a temp file survived a failed refresh"
ok "a failed refresh leaves secrets.zsh byte-identical and no temp file behind"
# ---- GitHub reads stay anonymous https after the tier applies ---------------
# The tier ships a git@github.com: rewrite for PUSHES. If it ever regresses to
# a blanket insteadOf, every https clone on a keyless fresh box breaks -- the
# first casualty was nvim's plugin bootstrap (live, 2026-08-22).
# Plain `git config --get`, not --global: --global does not follow the
# [include] seam by default, which made this pair pass vacuously.
git config --get 'url.git@github.com:.insteadof' >/dev/null 2>&1 \
&& fail "GitHub https READS are rewritten to ssh — a keyless box cannot clone plugins"
git config --get 'url.git@github.com:.pushinsteadof' >/dev/null 2>&1 \
|| fail "the GitHub push-over-ssh rewrite is gone entirely"
ok "GitHub reads stay https; only pushes are rewritten to ssh"
# ---- two tiers, two state files: neither warns about the other --------------
# Both tiers used to share ~/.config/chezmoi/chezmoistate.boltdb, and each wrote
# its config-template hash over the other's, so after this init every public
# command said "config file template has changed". `run_` scripts always show
# as " R"; anything else in either status is drift.
CZ=$HOME/.config/chezmoi
[ -f "$CZ/chezmoistate-private.boltdb" ] || fail "the private tier has no state file of its own"
grep -q '^persistentState = ' "$CZ/private.toml" || fail "private.toml does not name its state file"
pub=$(chezmoi status 2>&1)
prv=$(chezmoi -S "$HOME/.local/share/dotfiles-private" -c "$CZ/private.toml" \
--persistent-state "$CZ/chezmoistate-private.boltdb" status 2>&1)
for t in pub prv; do
eval "o=\$$t"
case $o in *"template has changed"*|*warning*)
printf '%s\n' "$o" | sed 's/^/ | /'; fail "$t tier warns after both inits" ;; esac
d=$(printf '%s\n' "$o" | grep -v '^ R ' | grep -v '^$' || true)
[ -z "$d" ] || { printf '%s\n' "$d" | sed 's/^/ | /'; fail "$t tier status is not clean"; }
done
ok "each tier has its own state file; neither warns and both statuses are clean"
echo "PRIVATE TIER PASS"
-94
View File
@@ -1,94 +0,0 @@
#!/bin/bash
# chezmoi is how dotup ARRIVES, so "it must already be here" is the natural
# assumption -- and it is wrong often enough to have broken a real install.
#
# get.chezmoi.io installs to ./bin RELATIVE TO THE CWD when -b is not given,
# which is exactly what the README's one-liner does. Run it from $HOME and the
# binary lands in ~/bin; run it from /workspace, as anyone in a container does,
# and it lands in /workspace/bin. Neither is on PATH, and the private tier then
# failed with `chezmoi: not found` AFTER writing the bws token -- half
# configured, at the very last step, having already spent the password.
#
# So this scenario puts the machine in exactly that state -- chezmoi nowhere
# find_tool looks -- and asks two questions:
#
# does dotup install one, before asking for anything?
# and if it CANNOT, does it say so before the password rather than after?
#
# It cannot be a unit test on a developer box: find_tool probes
# /home/linuxbrew/.linuxbrew/bin by absolute path, and any box with linuxbrew
# satisfies the lookup no matter what PATH says. A container has no such
# directory, so absence here is real.
set -u
fail() { echo "FAIL: $*"; exit 1; }
ok() { echo " ok $*"; }
# ---- public tier first, unaided, exactly as the README says ------------------
sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply "$PUB_URL" >/tmp/init.log 2>&1 \
|| { tail -20 /tmp/init.log; fail "public tier init"; }
D=$HOME/.local/bin/dotup
[ -x "$D" ] || fail "no dotup after the public apply"
ok "public tier applied"
# ---- now take chezmoi away, everywhere find_tool looks ----------------------
for c in "$HOME/.local/bin/chezmoi" "$HOME/bin/chezmoi" "$HOME/.npm-global/bin/chezmoi" \
/usr/local/bin/chezmoi /usr/local/go/bin/chezmoi \
/home/linuxbrew/.linuxbrew/bin/chezmoi /opt/homebrew/bin/chezmoi; do
[ -e "$c" ] && { sudo rm -f "$c" || rm -f "$c"; }
done
command -v chezmoi >/dev/null 2>&1 && fail "chezmoi is still on PATH; the state under test never happened"
for c in "$HOME/.local/bin/chezmoi" "$HOME/bin/chezmoi" "$HOME/.npm-global/bin/chezmoi" \
/usr/local/bin/chezmoi /usr/local/go/bin/chezmoi \
/home/linuxbrew/.linuxbrew/bin/chezmoi /opt/homebrew/bin/chezmoi; do
[ -e "$c" ] && fail "chezmoi is still at $c -- find_tool would find it"
done
ok "chezmoi is absent from every place find_tool looks"
# ---- tick the row that needs it, and answer q at the first prompt ------------
# `q` is enough: ensure_chezmoi runs BEFORE the prompt on purpose, so whatever
# it did has already happened by the time the first question is asked.
S=${XDG_CONFIG_HOME:-$HOME/.config}/dotfiles
mkdir -p "$S"; printf 'private/private-repo\n' > "$S/selected"
printf 'q\n' | timeout 180 script -q -c "$D private" /dev/null >/tmp/priv.log 2>&1
rc=$?
out=$(tr -d '\r' </tmp/priv.log | sed 's/\x1b\[[0-9;]*m//g')
printf '%s\n' "$out" | sed 's/^/ | /'
# ---- what must be true ------------------------------------------------------
case $out in
*"chezmoi is not on PATH or in the usual places"*) ok "it noticed chezmoi was missing" ;;
*) fail "dotup never noticed chezmoi was missing (rc=$rc)" ;;
esac
case $out in
*"the chezmoi installer failed"*|*"chezmoi still not found"*)
fail "the installer call did not install anything -- the private repo
cannot be cloned, and this is the failure that used to happen AFTER
the password had already been typed and the bws token written" ;;
esac
case $out in
*"the private repo cannot be cloned without chezmoi"*)
fail "dotup gave up on the private repo instead of installing chezmoi" ;;
esac
case $out in
*"chezmoi installed to ~/.local/bin"*) ok "it installed one, and said where" ;;
*) fail "no chezmoi was installed" ;;
esac
[ -x "$HOME/.local/bin/chezmoi" ] || fail "nothing executable at ~/.local/bin/chezmoi"
"$HOME/.local/bin/chezmoi" --version >/dev/null 2>&1 || fail "the installed chezmoi does not run"
ok "the installed chezmoi is a working binary"
# The ordering that makes the failure survivable: chezmoi is resolved BEFORE
# anything is asked for. If it can only be discovered missing afterwards, the
# password has been spent and the token is already on disk.
a=$(printf '%s\n' "$out" | grep -n 'installing it' | head -1 | cut -d: -f1)
b=$(printf '%s\n' "$out" | grep -n 'Bootstrap URL' | head -1 | cut -d: -f1)
[ -n "$a" ] && [ -n "$b" ] && [ "$a" -lt "$b" ] \
|| fail "chezmoi was not resolved before the first prompt (installing=$a prompt=$b)"
ok "chezmoi was resolved before the first question was asked"
case $out in
*"public-only machine"*) ok "q at the prompt left a public-only machine" ;;
*) fail "q was not accepted at the URL prompt" ;;
esac
echo "CHEZMOI-ABSENT PASS"
-203
View File
@@ -1,203 +0,0 @@
#!/usr/bin/env python3
"""Local stand-in for the whole remote side of a bootstrap.
One process serves three things a real machine reaches out to:
GET /<route>/bootstrap.env basic auth, returns the two-line blob
GET /git/dotfiles-public.git anonymous, smart git-http
GET /git/dotfiles-private.git basic auth, smart git-http
anything else connection closed with no response
The last one is not laziness. Caddy's catch-all is `handle { abort }`, which
closes the connection without a status line, so a retired route reports curl
exit 52/000 rather than 404. A mock that answered 404 there would let a wrong
assertion pass.
Serving git over HTTP rather than `git daemon` is deliberate too: the private
clone URL carries an inline token, and the code under test splits that token
out into a credential file. Over git:// there is no credential to split and
that entire path goes untested.
No credential is ever logged. Bodies are streamed, so packfiles of any size
work without buffering.
"""
import base64
import os
import socket
import subprocess
import sys
import threading
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
ROUTE = os.environ.get("LAB_ROUTE", "bootstrap")
USER = os.environ.get("LAB_USER", "ben")
PASS = os.environ.get("LAB_PASS", "lab-password")
GIT_ROOT = os.environ["LAB_GIT_ROOT"]
# The blob names the git URL, which names the port -- but the port is not
# known until bind() returns. Rather than start the server twice, let it
# substitute its own port: LAB_BLOB may contain {PORT}.
BLOB = os.environ["LAB_BLOB"]
GIT_TOKEN = os.environ.get("LAB_GIT_TOKEN", "lab-git-token")
# 0 means "any free port". Several scenarios run in parallel, so a fixed port
# turns a second run into "Address already in use" -- which reads like a lab
# fault rather than a scheduling one. The chosen port is printed for the
# caller to read back.
PORT = int(os.environ.get("LAB_PORT", "0"))
# Default to loopback. The driver overrides this with the docker0 address so
# containers can reach it; that interface is not routable off the box, which
# 0.0.0.0 would have been. A repo that is private by construction should not
# be reachable from the LAN because a test was running.
BIND = os.environ.get("LAB_BIND", "127.0.0.1")
BACKEND = "/usr/lib/git-core/git-http-backend"
def _check(header, user, pw):
if not header or not header.startswith("Basic "):
return False
try:
raw = base64.b64decode(header[6:]).decode("utf-8", "replace")
except Exception:
return False
got_u, _, got_p = raw.partition(":")
return got_u == user and got_p == pw
class Handler(BaseHTTPRequestHandler):
protocol_version = "HTTP/1.1"
server_version = "lab/1.0"
# The default logger writes the request line to stderr. Request lines here
# contain no credential (basic auth rides in a header), but the endpoint
# route is meant to be unguessable, so it stays out of the log too.
def log_message(self, fmt, *a):
pass
def _abort(self):
"""Close with no response at all -- what `handle { abort }` does.
BaseHTTPRequestHandler flushes wfile after handle_one_request returns,
so simply closing it raises out of the server's own plumbing and prints
a traceback that looks like a lab fault rather than the behaviour under
test. Point wfile at /dev/null first: the socket is genuinely gone, and
the inherited flush lands somewhere harmless.
"""
self.close_connection = True
try:
self.connection.shutdown(socket.SHUT_RDWR)
except OSError:
pass
try:
self.connection.close()
finally:
self.wfile = open(os.devnull, "wb")
def _unauth(self, realm):
body = b"unauthorized\n"
self.send_response(401)
self.send_header("WWW-Authenticate", 'Basic realm="%s"' % realm)
self.send_header("Content-Type", "text/plain")
self.send_header("Content-Length", str(len(body)))
self.end_headers()
self.wfile.write(body)
def do_GET(self):
self._route("GET")
def do_POST(self):
self._route("POST")
def _route(self, method):
path = self.path.split("?", 1)[0]
auth = self.headers.get("Authorization")
if path == "/%s/bootstrap.env" % ROUTE:
if not _check(auth, USER, PASS):
return self._unauth("bootstrap")
body = BLOB.encode()
self.send_response(200)
self.send_header("Content-Type", "text/plain")
self.send_header("Content-Length", str(len(body)))
self.end_headers()
return self.wfile.write(body)
if path.startswith("/git/"):
# The private repo demands the token; the public one is open,
# because a stranger really can clone the public tier.
if "dotfiles-private" in path and not _check(auth, "git", GIT_TOKEN):
return self._unauth("git")
return self._git(method, path)
self._abort()
def _git(self, method, path):
env = {
"GIT_PROJECT_ROOT": GIT_ROOT,
"GIT_HTTP_EXPORT_ALL": "1",
"PATH_INFO": path[len("/git"):],
"REQUEST_METHOD": method,
"QUERY_STRING": self.path.split("?", 1)[1] if "?" in self.path else "",
"REMOTE_ADDR": self.client_address[0],
"REMOTE_USER": "lab",
"PATH": os.environ.get("PATH", "/usr/bin:/bin"),
}
for h, e in (("Content-Type", "CONTENT_TYPE"),
("Content-Encoding", "HTTP_CONTENT_ENCODING"),
("Accept-Encoding", "HTTP_ACCEPT_ENCODING"),
("Git-Protocol", "HTTP_GIT_PROTOCOL")):
v = self.headers.get(h)
if v:
env[e] = v
n = int(self.headers.get("Content-Length") or 0)
if n:
env["CONTENT_LENGTH"] = str(n)
p = subprocess.Popen([BACKEND], env=env, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
if n:
p.stdin.write(self.rfile.read(n))
p.stdin.close()
# CGI response: headers, blank line, body. Status comes back as a
# `Status:` header when it is not 200.
head, status, sent = [], 200, []
while True:
line = p.stdout.readline()
if not line or line in (b"\r\n", b"\n"):
break
k, _, v = line.decode("latin-1").rstrip("\r\n").partition(":")
if k.lower() == "status":
status = int(v.strip().split()[0])
else:
head.append((k, v.strip()))
self.send_response(status)
for k, v in head:
self.send_header(k, v)
# Length is unknown up front for a packfile, so stream it chunked.
self.send_header("Transfer-Encoding", "chunked")
self.end_headers()
while True:
chunk = p.stdout.read(65536)
if not chunk:
break
self.wfile.write(b"%x\r\n" % len(chunk) + chunk + b"\r\n")
self.wfile.write(b"0\r\n\r\n")
p.stdout.close()
p.wait()
def _main():
global BLOB
if not os.path.exists(BACKEND):
sys.exit("git-http-backend not found at %s" % BACKEND)
srv = ThreadingHTTPServer((BIND, PORT), Handler)
srv.daemon_threads = True
BLOB = BLOB.replace("{PORT}", str(srv.server_address[1]))
print("lab: listening on %s:%d, route /%s, git root %s"
% (BIND, srv.server_address[1], ROUTE, GIT_ROOT), flush=True)
srv.serve_forever()
if __name__ == "__main__":
_main()
-30
View File
@@ -1,30 +0,0 @@
#!/bin/sh
# Turn a WORKING TREE into a bare repo the lab server can hand out.
#
# `git clone` of a checkout only ever produces committed refs, so testing a
# change used to mean pushing it first -- which is backwards, and is the reason
# every bug in this repo was found by a human on a real machine instead of by
# a test. Copying the tree and committing it into a throwaway repo means the
# code under test is whatever is on disk right now, staged or not.
#
# usage: snapshot.sh <src-tree> <serve-root> <name>
set -eu
src=$1; root=$2; name=$3
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
# --delete is pointless into a fresh mktemp dir, but it documents intent if
# this is ever pointed at a reused path.
tar -C "$src" --exclude=.git -cf - . | tar -C "$work" -xf -
git -C "$work" init -q -b main
git -C "$work" add -A
git -C "$work" \
-c user.email=lab@example.invalid -c user.name=lab \
commit -qm "working-tree snapshot of $name"
rm -rf "$root/$name.git"
mkdir -p "$root"
git clone -q --bare "$work" "$root/$name.git"
git -C "$root/$name.git" update-server-info
printf '%s\n' "$root/$name.git"
-46
View File
@@ -1,46 +0,0 @@
#!/bin/sh
# Drive the real picker over fzf's --listen API and assert the cursor does not
# jump on reload. Without that property, ticking four packages in a row means
# four scroll-backs and the tree design is unusable.
#
# fzf needs a terminal, so the work happens inside `script`, which re-enters
# this file with --inner rather than serialising a shell function (declare -f
# is bash-only, and the suite runs under dash).
set -eu
cd "$(dirname "$0")"
ROOT=$(CDPATH= cd -- .. && pwd)
export DOTUP_STATE=$PWD/state
export DOTUP_MANIFEST=$ROOT/dot_local/share/dotup/packages.tsv
S=$ROOT/dot_local/bin/executable_dotup
PORT=${DOTUP_TEST_PORT:-$((20000 + $$ % 20000))}
if [ "${1:-}" != "--inner" ]; then
DOTUP_TEST_PORT=$PORT; export DOTUP_TEST_PORT
script -qec "sh $0 --inner" /dev/null 2>&1 \
| tr -d '\r' | grep -oE 'CURSOR_(HELD|MOVED)[^ ]*|ROW_FLIPPED' || true
exit 0
fi
export FZF_DEFAULT_OPTS="--listen $PORT"
(
sleep 1.3
curl -s -XPOST "localhost:$PORT" -d 'pos(4)' >/dev/null; sleep 0.3
before=$(curl -s "localhost:$PORT" | grep -o '"position":[0-9]*')
row1=$(curl -s "localhost:$PORT" | grep -o '"current":{[^}]*}')
curl -s -XPOST "localhost:$PORT" \
-d "execute-silent($S toggle {2})+reload($S render)" >/dev/null
sleep 0.8
after=$(curl -s "localhost:$PORT" | grep -o '"position":[0-9]*')
row2=$(curl -s "localhost:$PORT" | grep -o '"current":{[^}]*}')
if [ "$before" = "$after" ]; then echo "CURSOR_HELD"; else echo "CURSOR_MOVED"; fi
# same row, opposite tick state
case "$row1|$row2" in
*'[x]'*'|'*'[ ]'*|*'[ ]'*'|'*'[x]'*) echo "ROW_FLIPPED" ;;
esac
curl -s -XPOST "localhost:$PORT" -d 'abort' >/dev/null
) &
sh "$S" preset defaults
sh "$S" expand-all >/dev/null
sh "$S" pick >/dev/null 2>&1 || true
wait
-165
View File
@@ -1,165 +0,0 @@
#!/bin/sh
# Mutation testing for dotup. Break the code on purpose; a suite that still
# passes has not been measuring what it claims to.
#
# sh .tests/mutate.sh every mutation in mutations/
# sh .tests/mutate.sh 02 05 13 just those
# sh .tests/mutate.sh --list what each one does and why it matters
# sh .tests/mutate.sh --keep leave the mutated tree behind on failure
#
# Each file in mutations/ is one deliberate bug: a header saying what it breaks
# and why that matters, the ASSERTION that is supposed to catch it, an OLD
# block that must appear EXACTLY ONCE in dot_local/bin/executable_dotup, and
# the NEW text to put in its place. A
# mutation whose OLD block no longer matches is reported as STALE rather than
# quietly skipped -- the code moved, and the mutation has to move with it.
#
# Nothing here touches the working tree. The whole repo is copied once, the
# copy's dotup is mutated, the copy's own tests run against it, and the copy's
# dotup is restored from a pristine byte-for-byte spare between runs.
#
# A mutation is KILLED when the suite it names fails AND the named assertion is
# one of the failures. A suite that fails for some unrelated reason is reported
# as WRONG-TEST: the bug was noticed by accident, which is not the same as being
# tested for, and the next edit to the unrelated test would lose it. SURVIVED
# means the bug is live and nothing noticed at all.
set -eu
cd "$(dirname "$0")"
HERE=$PWD
ROOT=$(CDPATH= cd -- .. && pwd)
MUTS=$HERE/mutations
KEEP=0; only=; LIST=0
while [ $# -gt 0 ]; do
case $1 in
--keep) KEEP=1 ;;
--list) LIST=1 ;;
-*) echo "unknown flag $1" >&2; exit 2 ;;
*) only="$only $1" ;;
esac
shift
done
G=$(printf '\033[32m'); R_=$(printf '\033[31m'); Y=$(printf '\033[33m')
B=$(printf '\033[1m'); Z=$(printf '\033[0m'); DIM=$(printf '\033[2m')
if [ "$LIST" = 1 ]; then
for f in "$MUTS"/*.mut; do
printf '%s%s%s\n' "$B" "$(basename "$f" .mut)" "$Z"
sed -n 's/^# what: / breaks /p; s/^# why: / matters /p
s/^# kills: / caught by /p; s/^# run: / suite /p' "$f"
done
exit 0
fi
WORK=${TMPDIR:-/tmp}/dotup-mutate.$$
cleanup() { [ "$KEEP" = 1 ] || rm -rf "$WORK"; }
trap cleanup EXIT INT TERM
echo "== copying the tree =="
mkdir -p "$WORK"
tar -C "$ROOT" --exclude=.git --exclude=tmp --exclude='.tests/state' -cf - . \
| tar -C "$WORK" -xf -
D=$WORK/dot_local/bin/executable_dotup
cp "$D" "$WORK/.dotup.pristine"
# ---------------------------------------------------------------- runners ---
# Both return 0 when the suite PASSED, which for a mutated tree is the bad news.
run_unit() { ( cd "$WORK/.tests" && sh test.sh ) >"$WORK/out" 2>&1; }
run_lab() { ( cd "$WORK/.tests/lab" && bash run.sh "$1" ) >"$WORK/out" 2>&1; }
run_suite() {
case $1 in
unit) run_unit ;;
lab:*) run_lab "${1#lab:}" ;;
*) echo "unknown suite: $1" >&2; return 125 ;;
esac
}
# What the suite said went wrong, in its own words. This is the evidence that a
# mutation was caught for a REASON rather than by a crash somewhere unrelated.
failures() {
sed 's/\x1b\[[0-9;]*m//g' "$WORK/out" \
| sed -n 's/^ FAIL \(.*\)$/\1/p; s/^FAIL: \(.*\)$/\1/p; s/^\(TIMEOUT: .*\)$/\1/p' \
| sed 's/ — .*//'
}
why_failed() { failures | head -3 | tr '\n' ';' | sed 's/;$//; s/;/; /g'; }
# --------------------------------------------------------------- baseline ---
echo "== baseline: the copy, unmutated =="
if run_unit; then
base=$(sed 's/\x1b\[[0-9;]*m//g' "$WORK/out" | sed -n 's/^\([0-9]* passed, [0-9]* failed\)$/\1/p' | tail -1)
printf ' %sunit%s %s\n' "$G" "$Z" "$base"
else
sed 's/\x1b\[[0-9;]*m//g' "$WORK/out" | tail -20
echo "${R_}the suite does not pass on an unmutated tree; nothing below would mean anything.${Z}"
exit 1
fi
# --------------------------------------------------------------- mutating ---
killed=0; survived=0; stale=0; wrong=0
: > "$WORK/table"
for f in "$MUTS"/*.mut; do
id=$(basename "$f" .mut)
if [ -n "$only" ]; then
want=0
for o in $only; do case $id in $o|$o-*|*"$o"*) want=1 ;; esac; done
[ "$want" = 1 ] || continue
fi
what=$(sed -n 's/^# what: //p' "$f")
suite=$(sed -n 's/^# run: //p' "$f")
kills=$(sed -n 's/^# kills: //p' "$f")
cp "$WORK/.dotup.pristine" "$D"
if ! python3 - "$f" "$D" <<'PY'
import sys
mut, target = sys.argv[1], sys.argv[2]
raw = open(mut).read()
body = raw.split('<<<OLD\n', 1)[1]
old, rest = body.split('<<<NEW\n', 1)
new = rest.split('<<<END\n', 1)[0]
src = open(target).read()
n = src.count(old)
if n != 1:
sys.exit("STALE: OLD block appears %d times, want exactly 1" % n)
open(target, 'w').write(src.replace(old, new, 1))
PY
then
printf ' %sSTALE%s %-38s %s\n' "$Y" "$Z" "$id" "$what"
printf 'STALE\t%s\t%s\t%s\t-\n' "$id" "$what" "$suite" >> "$WORK/table"
stale=$((stale + 1)); continue
fi
printf ' %s…%s %-38s %s' "$DIM" "$Z" "$id" "$DIM$suite$Z"
if run_suite "$suite"; then
printf '\r %sSURVIVED%s %-38s %s\n' "$R_" "$Z" "$id" "$what"
printf 'SURVIVED\t%s\t%s\t%s\t-\n' "$id" "$what" "$suite" >> "$WORK/table"
survived=$((survived + 1))
[ "$KEEP" = 1 ] && cp "$WORK/out" "$HERE/mutate-survived-$id.log"
# -e, not a bare pattern: several of these assertions begin with "--",
# which grep would read as its own flags.
elif [ -n "$kills" ] && ! failures | grep -qF -e "$kills"; then
# It broke something, but not the thing that is supposed to be watching
# it. That is luck, and luck is lost the next time the other test moves.
printf '\r %sWRONG-TEST%s %-36s %s\n' "$Y" "$Z" "$id" "expected [$kills], got [$(why_failed)]"
printf 'WRONG-TEST\t%s\t%s\t%s\t%s\n' "$id" "$what" "$suite" "$(why_failed)" >> "$WORK/table"
wrong=$((wrong + 1))
[ "$KEEP" = 1 ] && cp "$WORK/out" "$HERE/mutate-wrongtest-$id.log"
else
printf '\r %sKILLED%s %-38s %s\n' "$G" "$Z" "$id" "${kills:-$(why_failed)}"
printf 'KILLED\t%s\t%s\t%s\t%s\n' "$id" "$what" "$suite" "${kills:-$(why_failed)}" >> "$WORK/table"
killed=$((killed + 1))
fi
done
cp "$WORK/.dotup.pristine" "$D"
total=$((killed + survived + stale + wrong))
[ "$total" -gt 0 ] || { echo "no mutations selected"; exit 2; }
echo
printf '%sMUTATION\tCATCHES IT\tSUITE\tCAUGHT BY%s\n' "$B" "$Z"
awk -F'\t' '{printf "%-9s %-38s %-34s %s\n", $1, $2, $4, $5}' "$WORK/table"
echo
printf '%smutation score: %d/%d killed%s' "$B" "$killed" "$total" "$Z"
[ "$survived" -eq 0 ] || printf ' %s(%d SURVIVED)%s' "$R_" "$survived" "$Z"
[ "$wrong" -eq 0 ] || printf ' %s(%d wrong-test)%s' "$Y" "$wrong" "$Z"
[ "$stale" -eq 0 ] || printf ' %s(%d stale)%s' "$Y" "$stale" "$Z"
printf '\n\n'
[ "$survived" -eq 0 ] && [ "$stale" -eq 0 ] && [ "$wrong" -eq 0 ]
@@ -1,8 +0,0 @@
# what: the private filter in selected_packages, removed
# why: the "private is never a package" invariant is what makes --unattended safe
# kills: no private row reaches the plan
# run: unit
<<<OLD
$3=="private" { next }
<<<NEW
<<<END
@@ -1,9 +0,0 @@
# what: the bws checksum comparison, inverted: accepts on mismatch, rejects on match
# why: the binary is about to hold the key to every other credential
# kills: a checksum mismatch refuses to install
# run: unit
<<<OLD
if [ -n "$want" ] && [ "$want" != "$got" ]; then
<<<NEW
if [ -n "$want" ] && [ "$want" = "$got" ]; then
<<<END
-9
View File
@@ -1,9 +0,0 @@
# what: the bws token written 644 instead of 600
# why: any account on the box could then read the machine credential
# kills: the bws token is written 600
# run: unit
<<<OLD
chmod 600 "$BWS_TOKEN"
<<<NEW
chmod 644 "$BWS_TOKEN"
<<<END
@@ -1,8 +0,0 @@
# what: the chmod -R go-rwx on the cloned private source, removed
# why: the clone lands at the caller umask -- 022 on stock Ubuntu -- holding ssh config and machine identity
# kills: the private source is unreadable to anyone else
# run: unit
<<<OLD
[ ! -d "$PRIV_SRC" ] || chmod -R go-rwx "$PRIV_SRC" 2>/dev/null || :
<<<NEW
<<<END
-13
View File
@@ -1,13 +0,0 @@
# what: the password retry loop: any non-200 is fatal again
# why: these credentials are asked for after every package is installed; one typo used to cost the whole install
# kills: …then asks again, keeping the URL
# run: unit
<<<OLD
P_BLOB=''
say " Try again, or type q at the URL prompt to stay public-only."
done
<<<NEW
P_BLOB=''
return 1
done
<<<END
@@ -1,11 +0,0 @@
# what: cmd_private's unattended guard, inverted
# why: an unattended run would sit at a password prompt nobody is there to answer
# kills: --unattended: nobody is here to type it
# run: unit
<<<OLD
if [ "$UNATTENDED" -eq 1 ]; then
warn "unattended: the private tier needs a password nobody is here to type — skipped"
<<<NEW
if [ "$UNATTENDED" -ne 1 ]; then
warn "unattended: the private tier needs a password nobody is here to type — skipped"
<<<END
@@ -1,9 +0,0 @@
# what: cmd_private's terminal guard, inverted
# why: the private tier would run with no terminal, reading EOF for a password
# kills: no tty: it says THAT instead
# run: unit
<<<OLD
[ -t 0 ] || { warn "no terminal: the private tier needs a password — skipped"; return 0; }
<<<NEW
[ ! -t 0 ] || { warn "no terminal: the private tier needs a password — skipped"; return 0; }
<<<END
@@ -1,19 +0,0 @@
# what: cmd_install's unattended invasive refusal, deleted
# why: a stale state file would install a docker daemon on a machine with nobody at the keyboard
# kills: the daemon never reaches a package manager
# run: unit
<<<OLD
if [ "$UNATTENDED" -eq 1 ]; then
inv=$(awk -F'\t' -v selfile="$SEL" '
BEGIN{ while((getline l < selfile)>0) sel[l]=1 }
!/^[#@]/ && NF>=3 && $3=="invasive" && (($1"/"$2) in sel) {print $1"/"$2}' "$MANIFEST")
if [ -n "$inv" ]; then
warn "unattended: refusing invasive packages$(printf ' %s' $inv)"
for k in $inv; do
awk -F'\t' -v k="$k" '$3!=k' "$tbl" > "$tbl.f"; mv "$tbl.f" "$tbl"
done
fi
fi
<<<NEW
<<<END
@@ -1,11 +0,0 @@
# what: cmd_install always returns 0
# why: a CI run or a wrapper script cannot tell a clean install from six failures
# kills: the run exits non-zero
# run: unit
<<<OLD
printf '\n%s%d package(s) did not install.%s Everything else did.\n' "$YEL" "$n" "$R" >&2
return 1
<<<NEW
printf '\n%s%d package(s) did not install.%s Everything else did.\n' "$YEL" "$n" "$R" >&2
return 0
<<<END
-9
View File
@@ -1,9 +0,0 @@
# what: note_fail() neutered: failures are dropped
# why: the summary, the count and the exit code all come from this one file
# kills: …under a heading you can find
# run: unit
<<<OLD
note_fail() { printf '%s\t%s\n' "$1" "$2" >> "$FAILED"; err "$1: $2"; }
<<<NEW
note_fail() { :; }
<<<END
@@ -1,9 +0,0 @@
# what: ensure_chezmoi's installer call replaced with true
# why: the private tier died with `chezmoi: not found` AFTER writing the bws token
# kills: the installer call did not install anything
# run: lab:scenarios/31-chezmoi-absent.sh
<<<OLD
sh -c "$(curl -fsLS get.chezmoi.io)" -- -b "$HOME/.local/bin" >/dev/null 2>&1 \
<<<NEW
true >/dev/null 2>&1 \
<<<END
@@ -1,9 +0,0 @@
# what: find_tool no longer looks in ~/.local/bin
# why: uv, bws and chezmoi all land there, on no PATH the running process has
# kills: uv is found in ~/.local/bin, off PATH
# run: unit
<<<OLD
for ft_c in "$HOME/.local/bin/$1" "$HOME/bin/$1" "$HOME/.npm-global/bin/$1" \
<<<NEW
for ft_c in "$HOME/bin/$1" "$HOME/.npm-global/bin/$1" \
<<<END
@@ -1,11 +0,0 @@
# what: the apt one-at-a-time retry, removed
# why: apt refuses the whole batch when one name is unusable; the retry is the difference between 34 installed and 0
# kills: …then btop on its own
# run: unit
<<<OLD
for p in $keep; do
run_sh "${SUDO:+$SUDO }DEBIAN_FRONTEND=noninteractive apt-get install -y $p" \
|| note_fail "$p" "apt install failed"
done
<<<NEW
<<<END
@@ -1,8 +0,0 @@
# what: the npm one-at-a-time retry, removed
# why: same shape as apt: one bad spec takes every other tool down with it
# kills: …then @openai/codex on its own
# run: unit
<<<OLD
for p in $specs; do run_sh "$NPM install -g $p" || note_fail "$(keyof npm "$p")" "npm install failed"; done
<<<NEW
<<<END
-9
View File
@@ -1,9 +0,0 @@
# what: install_fzf's base URL pointed at a host that does not exist
# why: the picker cannot draw the list that installs fzf without fzf
# kills: the fetch goes to the fzf release download URL
# run: unit
<<<OLD
base=https://github.com/junegunn/fzf/releases/download
<<<NEW
base=https://github.invalid/junegunn/fzf/releases/download
<<<END
-9
View File
@@ -1,9 +0,0 @@
# what: the neovim tarball extracted to /opt/nvim-TYPO
# why: tar succeeds, the symlink dangles, and nothing says so
# kills: the tarball is extracted where the symlink points
# run: unit
<<<OLD
run_sh "${SUDO:+$SUDO }rm -rf /opt/nvim && ${SUDO:+$SUDO }mkdir -p /opt/nvim && ${SUDO:+$SUDO }tar -xzf '$WORKDIR/nvim.tgz' -C /opt/nvim --strip-components=1" \
<<<NEW
run_sh "${SUDO:+$SUDO }rm -rf /opt/nvim && ${SUDO:+$SUDO }mkdir -p /opt/nvim && ${SUDO:+$SUDO }tar -xzf '$WORKDIR/nvim.tgz' -C /opt/nvim-TYPO --strip-components=1" \
<<<END
@@ -1,8 +0,0 @@
# what: install_deb's install step, removed: it downloads and stops
# why: chrome and ghostty would report success having installed nothing
# kills: …and then handed to the package manager
# run: unit
<<<OLD
run_sh "${SUDO:+$SUDO }apt-get install -y '$f'" || note_fail "$(keyof deb "$s")" "dpkg install failed"
<<<NEW
<<<END
@@ -1,10 +0,0 @@
# what: a comment moved back INSIDE the fzf line-continuation (the DU-C1 shape)
# why: the `\`-newline is stripped first, so the comment's own newline ends the command: fzf gets two binds and the lines below run as a command named --bind
# kills: dotup pick exits 0
# run: unit
<<<OLD
--bind "tab:execute-silent($SELF expand {2})+reload($SELF render)" \
<<<NEW
--bind "tab:execute-silent($SELF expand {2})+reload($SELF render)" \
# clear-query is not cosmetic: ^t toggles every row the filter shows.
<<<END
@@ -1,56 +0,0 @@
# what: the parser stops at the subcommand again, so flags after it are dropped
# why: DU-H1 as it shipped: `dotup install --unattended` ran a FULL ATTENDED install and said nothing, which is how invasive packages reached a machine that had asked for the safe defaults
# kills: install --unattended refuses invasive too
# run: unit
<<<OLD
CMD=
endopts=0
n=$#; i=0
while [ "$i" -lt "$n" ]; do
i=$((i + 1)); a=$1; shift
if [ "$endopts" -eq 0 ]; then
case $a in
--) endopts=1; continue ;;
--unattended) UNATTENDED=1; ASSUME_YES=1; continue ;;
--print|-n) DRYRUN=1; continue ;;
--yes|-y) ASSUME_YES=1; continue ;;
-h|--help) usage; exit 0 ;;
-?*) err "unknown flag: $a"; usage; exit 2 ;;
esac
fi
# The first bare word is the subcommand; every later one is an operand,
# rotated to the back of "$@" so the dispatch below reads them in the order
# they were typed with the flags taken out from between them.
if [ -z "$CMD" ]; then CMD=$a; else set -- "$@" "$a"; fi
done
# What each subcommand accepts. -1 is "as many as you like". An unknown
# subcommand, or one word more than a subcommand can use, is the same class of
# mistake as an unknown flag and gets the same answer: say so, and stop.
# This list and the dispatch below must name the same commands.
amin=0; amax=0
case ${CMD:-run} in
run|pick|install|private|render|expand-all|plan|preflight|fzf-path) ;;
toggle|toggle-shown|expand) amax=-1 ;;
preset|explain|resolve) amax=1 ;;
vercmp) amin=2; amax=2 ;;
*) err "unknown command: $CMD"; usage; exit 2 ;;
esac
[ "$#" -ge "$amin" ] || { err "${CMD:-run} needs $amin argument(s), got $#"; usage; exit 2; }
[ "$amax" -lt 0 ] || [ "$#" -le "$amax" ] || {
err "${CMD:-run} takes at most $amax argument(s), got $#:$(printf ' %s' "$@")"
usage; exit 2; }
<<<NEW
CMD=
while [ $# -gt 0 ]; do
case $1 in
--unattended) UNATTENDED=1; ASSUME_YES=1 ;;
--print|-n) DRYRUN=1 ;;
--yes|-y) ASSUME_YES=1 ;;
-h|--help) usage; exit 0 ;;
--*) err "unknown flag: $1"; usage; exit 2 ;;
*) CMD=$1; shift; break ;;
esac
shift
done
<<<END
@@ -1,9 +0,0 @@
# what: an unrecognised flag is skipped instead of stopping the run
# why: the other half of DU-H1 -- a parser that shrugs at `--unatended` installs a different set of packages than the operator asked for, with no way to tell
# kills: an unknown flag after the subcommand is refused
# run: unit
<<<OLD
-?*) err "unknown flag: $a"; usage; exit 2 ;;
<<<NEW
-?*) continue ;;
<<<END
@@ -1,13 +0,0 @@
# what: the neovim tarball is downloaded to and extracted from /tmp/nvim.tgz again
# why: DU-H2: a fixed name in a world-writable directory, unpacked by `sudo tar` -- anyone on the box can pre-create it as a symlink or swap it between the two commands and have tar write their content as root
# kills: no download is written to a fixed /tmp path
# run: unit
<<<OLD
run_sh "{ curl -fsSL '$b/nvim-linux-$a.tar.gz' -o '$WORKDIR/nvim.tgz' || curl -fsSL '$b/nvim-linux64.tar.gz' -o '$WORKDIR/nvim.tgz'; } && [ -s '$WORKDIR/nvim.tgz' ]" \
|| { note_fail "$key" "tarball download failed or arrived empty"; continue; }
run_sh "${SUDO:+$SUDO }rm -rf /opt/nvim && ${SUDO:+$SUDO }mkdir -p /opt/nvim && ${SUDO:+$SUDO }tar -xzf '$WORKDIR/nvim.tgz' -C /opt/nvim --strip-components=1" \
<<<NEW
run_sh "curl -fsSL '$b/nvim-linux-$a.tar.gz' -o /tmp/nvim.tgz || curl -fsSL '$b/nvim-linux64.tar.gz' -o /tmp/nvim.tgz" \
|| { note_fail "$key" "tarball download failed"; continue; }
run_sh "${SUDO:+$SUDO }rm -rf /opt/nvim && ${SUDO:+$SUDO }mkdir -p /opt/nvim && ${SUDO:+$SUDO }tar -xzf /tmp/nvim.tgz -C /opt/nvim --strip-components=1" \
<<<END
@@ -1,9 +0,0 @@
# what: the EXIT trap that removes the run's private download directory is gone
# why: the directory holds whatever was fetched on the way through; leaving one behind per run turns a fix for a race into a slow leak of downloaded payloads under /tmp
# kills: …and which does not outlive the run
# run: unit
<<<OLD
trap dotup_cleanup EXIT INT TERM
<<<NEW
:
<<<END
@@ -1,9 +0,0 @@
# what: ^t's dependency walk no longer stops at an invasive row (BUG-1, reintroduced)
# why: filtering for `nvidia` and pressing ^t ticks the three docker rows off screen — a root-equivalent daemon group nobody looked at
# kills: …and the invasive group it @needs stays off
# run: unit
<<<OLD
go=$(printf '%s\n' "$shown" | expand_deps invasive-stop)
<<<NEW
go=$(printf '%s\n' "$shown" | expand_deps)
<<<END
@@ -1,13 +0,0 @@
# what: ^t's second press goes back to the reverse @needs closure instead of the journal (BUG-2, reintroduced)
# why: the reverse edges do not retract what the forward ones pulled in, so ^t ^t leaves the dependencies ticked and is not an undo
# kills: …and ^t ^t hands that back too, node included
# run: unit
<<<OLD
if [ -f "$TICK" ] && [ "$shown" = "$(sed '/^=$/,$d' "$TICK")" ]; then
go=$(sed '1,/^=$/d' "$TICK")
else
go=$(printf '%s\n' "$shown" | expand_rdeps)
fi
<<<NEW
go=$(printf '%s\n' "$shown" | expand_rdeps)
<<<END
@@ -1,18 +0,0 @@
# what: get.docker.com piped straight into a root sh instead of downloaded and checked
# why: no pipefail in sh: a 404 or truncated body runs as root AND reports success
# kills: a failed download is reported, not swallowed
# run: unit
<<<OLD
run_sh "curl -fsSL https://get.docker.com -o '$WORKDIR/get-docker.sh' && [ -s '$WORKDIR/get-docker.sh' ]" \
|| { note_fail "$key" "the Docker install script download failed or arrived empty"
DOCKER_SCRIPTED=fail; continue; }
# get.docker.com escalates on its own when it is not run as root,
# but this box may have no sudo at all and dotup already knows
# which -- so pass it explicitly and keep the command that is
# printed identical to the one that runs.
run_sh "${SUDO:+$SUDO }sh '$WORKDIR/get-docker.sh'" \
|| { note_fail "$key" "the official Docker install script failed"
<<<NEW
run_sh "curl -fsSL https://get.docker.com | ${SUDO:+$SUDO }sh" \
|| { note_fail "$key" "the official Docker install script failed"
<<<END
@@ -1,13 +0,0 @@
# what: buildx and compose rows say "covered" even when the docker install failed
# why: one honest failure would be reported as two invented successes
# kills: …and the other two rows say they were not attempted
# run: unit
<<<OLD
if [ "$DOCKER_SCRIPTED" = ok ]; then
say " $key: covered by the docker group's single install"
else
note_fail "$key" "not attempted — the docker install failed"
fi
<<<NEW
say " $key: covered by the docker group's single install"
<<<END
@@ -1,11 +0,0 @@
# what: Claude Code's installer piped straight into bash instead of downloaded and checked
# why: no pipefail: a 404 or truncated body runs AND reports success
# kills: …checks it arrived non-empty
# run: unit
<<<OLD
run_sh "curl -fsSL https://claude.ai/install.sh -o '$WORKDIR/claude-install.sh' && [ -s '$WORKDIR/claude-install.sh' ]" \
|| { note_fail "$key" "the Claude Code install script download failed or arrived empty"; continue; }
run_sh "bash '$WORKDIR/claude-install.sh'" \
<<<NEW
run_sh "curl -fsSL https://claude.ai/install.sh | bash" \
<<<END
@@ -1,10 +0,0 @@
# what: the Claude Desktop signing key is placed without checking its fingerprint
# why: apt would trust whatever key arrived for packages it installs as root
# kills: a key with the wrong fingerprint is refused
# run: unit
<<<OLD
[ "$cd_fpr" = "$CLAUDE_DESKTOP_FPR" ] || {
note_fail "$key" "signing key fingerprint is not Anthropic's — refusing to trust it"; continue; }
<<<NEW
: "$cd_fpr"
<<<END
@@ -1,12 +0,0 @@
# what: the go channel runs before the tarball channel that unpacks go
# why: every go install on a fresh box would be "go: not found"
# kills: the go tarball is unpacked before any go install
# run: unit
<<<OLD
install_brew "$(col brew) $BREW_EXTRA"
install_bespoke tarball "$(keys tarball)"
<<<NEW
install_brew "$(col brew) $BREW_EXTRA"
install_bespoke go "$(keys go)"
install_bespoke tarball "$(keys tarball)"
<<<END
@@ -1,11 +0,0 @@
# what: confirm() decides on `[ -t 0 ]` again instead of opening /dev/tty
# why: `dotup < /dev/null` in a terminal picks, then installs with no [y/N] (ISSUE-9)
# kills: stdin /dev/null with a terminal still asks [y/N]
# run: unit
<<<OLD
(exec 3</dev/tty) 2>/dev/null || return 0
printf '\n install? [y/N] ' >&2
<<<NEW
[ -t 0 ] || return 0
printf '\n install? [y/N] ' >&2
<<<END
@@ -1,11 +0,0 @@
# what: core/brew runs its apt prerequisites on every platform again
# why: a Mac has no apt; the line warns, and the sudo it needs is never asked for
# kills: darwin: no apt prerequisites on a machine with no apt
# run: unit
<<<OLD
if [ "$PLAT" = apt ]; then
# The installer's own documented prerequisites. git is already
<<<NEW
if true; then
# The installer's own documented prerequisites. git is already
<<<END
@@ -1,10 +0,0 @@
# what: the install pipeline no longer ends with herdr's integration step
# why: a new laptop gets herdr with no agent hooks: panes show no agent state
# kills: herdr installs the claude integration
# run: unit
<<<OLD
install_uv "$(col uv)"
herdr_integrations
<<<NEW
install_uv "$(col uv)"
<<<END
@@ -1,9 +0,0 @@
# what: herdr's `current` status is ignored and every integration is reinstalled
# why: each run rewrites hook files herdr already manages; not idempotent
# kills: …but not one herdr reports current
# run: unit
<<<OLD
*": current"*) continue ;;
<<<NEW
*": currentXX"*) continue ;;
<<<END
@@ -1,8 +0,0 @@
# what: nvim's first boot no longer puts the seeded lazy-lock.json back
# why: restore then pins to the tips the boot just wrote, and the pins are lost
# kills: …against the SEEDED lockfile, not the one the boot rewrote
# run: unit
<<<OLD
run_sh "cp '$nb_seed' '$nb_lock'" || { warn "could not put the seeded lazy-lock.json back"; return 0; }
<<<NEW
<<<END
@@ -1,8 +0,0 @@
# what: the nvim first-boot step runs even where lazy already manages plugins
# why: it would overwrite a lockfile the user moved on with :Lazy update
# kills: …and nvim is not started
# run: unit
<<<OLD
[ ! -e "$nb_lazy" ] || return 0
<<<NEW
<<<END
-123
View File
@@ -1,123 +0,0 @@
#!/usr/bin/env python3
"""Drive a command on a real pty from a small expect/send script.
The private tier refuses to run without a terminal -- `[ -t 0 ]` is one of the
guards under test -- so every assertion about the password prompt, the retry
loop, the token file and the clone needs a pty to exist at all. `expect` is not
installed everywhere; python3 is, and the whole of what is needed here is
"read until this pattern, then write that line".
ptydrive.py [--timeout SEC] --script FILE -- cmd [args...]
Script lines, blank lines and #-comments ignored:
expect <python regex> wait for it in everything the child has written
send <text> write it, plus a newline
sendraw <text> write it with no newline
close close the child's input (EOF)
Everything the child writes is copied to stdout, so the caller greps the
transcript exactly as it would grep any other command's output. Exit status is
the child's, or 3 for "a pattern never arrived" -- which names the pattern on
stderr rather than letting the run die of a later, unrelated timeout.
"""
import argparse
import os
import pty
import re
import select
import sys
import time
ap = argparse.ArgumentParser()
ap.add_argument("--timeout", type=float, default=20.0)
ap.add_argument("--script", required=True)
ap.add_argument("cmd", nargs=argparse.REMAINDER)
a = ap.parse_args()
cmd = a.cmd[1:] if a.cmd and a.cmd[0] == "--" else a.cmd
if not cmd:
sys.exit("ptydrive.py: no command")
steps = []
for raw in open(a.script):
line = raw.rstrip("\n")
if not line.strip() or line.lstrip().startswith("#"):
continue
verb, _, rest = line.partition(" ")
steps.append((verb, rest))
pid, fd = pty.fork()
if pid == 0:
os.execvp(cmd[0], cmd)
os._exit(127)
buf = ""
out = []
deadline = time.time() + a.timeout
eof = False
def pump(block=0.2):
"""Read whatever is there. Returns False once the child's side is gone."""
global buf, eof
r, _, _ = select.select([fd], [], [], block)
if not r:
return True
try:
chunk = os.read(fd, 65536)
except OSError:
chunk = b""
if not chunk:
eof = True
return False
text = chunk.decode("utf-8", "replace")
buf += text
out.append(text)
return True
status = 0
try:
for verb, arg in steps:
if verb == "expect":
pat = re.compile(arg)
end = time.time() + a.timeout
while not pat.search(buf):
if time.time() > end:
sys.stderr.write("ptydrive.py TIMEOUT: never saw /%s/\n" % arg)
status = 3
raise SystemExit
if not pump():
if pat.search(buf):
break
sys.stderr.write("ptydrive.py EOF before /%s/\n" % arg)
status = 4
raise SystemExit
# Consume up to and including the match so a later `expect` for the
# same text waits for a NEW one -- the retry loop asks for the same
# three prompts twice, and matching the first round twice would
# prove nothing.
buf = buf[pat.search(buf).end():]
elif verb in ("send", "sendraw"):
data = arg + ("\n" if verb == "send" else "")
os.write(fd, data.encode())
elif verb == "close":
os.close(fd)
fd = -1
else:
sys.exit("ptydrive.py: unknown verb %r" % verb)
except SystemExit:
pass
# Drain whatever is left, then reap.
while not eof and time.time() < deadline:
if not pump(0.1):
break
try:
_, wstatus = os.waitpid(pid, 0)
child = os.waitstatus_to_exitcode(wstatus)
except ChildProcessError:
child = 0
sys.stdout.write("".join(out))
sys.stdout.flush()
sys.exit(status if status else (child if child >= 0 else 128 - child))
-118
View File
@@ -1,118 +0,0 @@
#!/bin/sh
# Build a SEALED bin directory: the whole of $PATH for a run under test.
#
# sh seal.sh <dir> [--with name ...] [--without name ...]
#
# The old harness prepended .tests/fakebin to the caller's $PATH. That fails
# OPEN: a package manager with no fake here simply fell through to the real one,
# and an audit of this suite invoked the host's actual `brew`. The seal fails
# CLOSED. It holds exactly two kinds of thing --
#
# REAL pure, local, side-effect-free tools dotup is entitled to use: awk,
# sed, install, sha256sum, tar. Faking these would weaken the test;
# `sha256sum` in particular has to be the real one or the checksum
# comparison is checking a fixture against itself.
# FAKE anything that installs, downloads, or needs root. Symlinks to _fake.
#
# -- and nothing else. A tool that is neither is command-not-found, which is a
# visible failure rather than a silent hand-off to the machine.
#
# One hole cannot be closed from here and is reported rather than hidden:
# find_tool probes /usr/local/bin, /usr/local/go/bin, /home/linuxbrew/... and
# /opt/homebrew/bin by ABSOLUTE path, so on a developer box those directories
# can satisfy a lookup no matter what PATH says. The seal therefore ships a fake
# for every name that is shadowed there -- `command -v` is tried first, so the
# fake wins -- and writes the shadow list to <dir>/.shadowed so a test that
# needs a tool to be genuinely ABSENT can say so instead of quietly passing.
set -eu
# gzip is here because tar shells out to it: without it `tar xz` dies with
# "gzip: not found" -- which is the seal working, and is how it was found.
REAL='sh awk grep sed sort cut tr head tail id uname mkdir cp mv rm cat
dirname basename chmod mktemp find install sha256sum stty tar gzip ln
touch true false env expr wc stat bash xz'
# Deliberately NOT here by default, each for a reason a test depends on:
# sudo absent means SUDO='' and apt-get is invoked directly, which is the
# only way FAKE_FAIL=apt-get can reach the installer at all.
# fzf absent is what makes ensure_fzf actually fetch one.
# bws absent is what makes the private tier actually install it.
FAKE='curl apt-get apt-cache brew npm uv snap flatpak xcode-select
git dpkg unzip chezmoi gpg'
# docker absent is what makes the docker rows actually run get.docker.com;
# the fake the script drops behaves like every other one here.
# claude, rustup, claude-desktop
# absent is what makes those script rows actually run; the
# installers they fetch drop fakes like every other one here.
# fc-cache absent is a fresh container; the font rows say so and carry on.
# herdr, codex, pi, omp
# absent is a box with no herdr, where the integration step must say
# nothing; a test that wants them adds them with --with.
OPTIONAL='sudo fzf bws nvim go node docker claude rustup claude-desktop fc-cache herdr codex pi omp'
dir=${1:?usage: seal.sh <dir> [--with name ...] [--without name ...]}; shift
# Everything the seal KNOWS about, fixed before --without takes anything out: a
# hole punched on purpose is still an accounted-for tool, and must not trip the
# coverage audit below.
KNOWN="$REAL $FAKE $OPTIONAL"
mode=
for a in "$@"; do
case $a in
--with) mode=with ;;
--without) mode=without ;;
*) case $mode in
with) FAKE="$FAKE $a"; KNOWN="$KNOWN $a" ;;
without) FAKE=$(printf '%s\n' $FAKE | grep -vx "$a" | tr '\n' ' ') ;;
*) echo "seal.sh: stray argument $a" >&2; exit 2 ;;
esac ;;
esac
done
here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
FB=$here/fakebin
[ -x "$FB/_fake" ] || { echo "seal.sh: no $FB/_fake" >&2; exit 1; }
rm -rf "$dir"; mkdir -p "$dir"
ln -s "$FB/_fake" "$dir/_fake"
ln -s "$FB/_curl" "$dir/_curl"
# Resolved by looking, not by `command -v`: an interactive shell reports
# aliases and functions, and a symlink to a bare name is a loop.
miss=
for t in $REAL; do
found=
for bd in /usr/bin /bin /usr/local/bin /sbin /usr/sbin; do
[ -x "$bd/$t" ] && { ln -sf "$bd/$t" "$dir/$t"; found=1; break; }
done
[ -n "$found" ] || miss="$miss $t"
done
[ -z "$miss" ] || { echo "seal.sh: host is missing real tools:$miss" >&2; exit 1; }
for t in $FAKE; do ln -sf "$dir/_fake" "$dir/$t"; done
# ------------------------------------------------------------- the audits ---
# 1. Anything dotup probes for must be accounted for. A new `have foo` with no
# fake would otherwise fall through to the host the moment someone adds one.
D=${DOTUP_SEAL_TARGET:-$here/../dot_local/bin/executable_dotup}
probes=$(grep -v '^[[:space:]]*#' "$D" \
| grep -oE '\b(have|find_tool) [a-z][a-z0-9-]*' \
| awk '{print $2}' | sort -u || :)
unknown=
for p in $probes; do
case " $KNOWN " in *" $p "*) ;; *) unknown="$unknown $p" ;; esac
done
[ -z "$unknown" ] || {
echo "seal.sh: dotup probes for tools the seal has never heard of:$unknown" >&2
echo " add them to REAL, FAKE or OPTIONAL -- do not let them fall through" >&2
exit 1; }
# 2. The absolute-path hole, reported rather than papered over. $KNOWN, not
# $FAKE: a name taken out with --without is exactly the name a test wants to
# be absent, so it is the one that most needs checking.
: > "$dir/.shadowed"
for t in $KNOWN; do
for bd in /usr/local/bin /usr/local/go/bin /home/linuxbrew/.linuxbrew/bin /opt/homebrew/bin; do
[ -x "$bd/$t" ] || continue
[ -e "$dir/$t" ] || printf '%s\t%s\n' "$t" "$bd/$t" >> "$dir/.shadowed"
done
done
printf '%s\n' "$dir"
-1639
View File
File diff suppressed because it is too large. Load diff
+7
View File
@@ -0,0 +1,7 @@
This repository is being used as a Dolt remote.
ref=refs/dolt/data
head=b18b9aa2b5a4dcc933ba17f5e8ef73ea3e5a6508
timestamp=2026-11-20T17:04:52Z
-346
View File
@@ -1,346 +0,0 @@
# dotfiles — public tier
Everything a machine needs to become a working machine, and nothing that makes
it *mine*. Clone it anonymously, apply it to a throwaway VM, and you get the
editor, the shell, the terminal and the tools. You do not get my name, my email,
my hosts, my agent config, or any credential — because none of that is in here.
The other half lives in a private repo you cannot clone without a password. That
split is the whole design, and it is structural rather than a policy: the gate
is *which repo a machine can obtain*, not a `.chezmoiignore` rule that could be
misconfigured once and leak.
Why the repo is shaped this way: **`DESIGN.md`**. How it got here: **`PLAN.md`**.
Both live in the working repo, not this one.
---
## Install
```sh
sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply <this repo url>
~/.local/bin/dotup
```
The first line is also wrapped as `bootstrap.sh`, which defaults to this
repo's own clone URL — the one place in the tier a real host appears, because
fetching the file proves you already know it:
```sh
curl -fsSL <this repo raw url>/bootstrap.sh | sh
```
Two commands. The first lays down the files and clones the six externals; the
second picks and installs the software. There is no third step, and nothing
here prompts for anything.
**Type the second path in full.** Bare `dotup` will not be found in the shell
that ran the install, and that is not a bug in either command: Ubuntu's own
`~/.profile` adds `~/.local/bin` to `PATH` only if the directory already exists
*when you log in*. On a fresh box it does not, the install then creates it, and
the shell you are sitting in never re-reads `.profile`. A new login shell finds
it. Nothing a child process can do changes the `PATH` of its parent, so the
install prints the working path rather than pretending otherwise.
**git does not have to be installed first.** It used to: chezmoi is a static
download and installs fine, but all six `git-repo` externals need git, and
Ubuntu cloud images, WSL and the docker image all ship curl and no git — so the
documented first command failed on the most ordinary kind of fresh box there
is. `.chezmoiscripts/run_before_00-require-git.sh` installs it across
apt/dnf/yum/pacman/zypper/apk/brew, and explains itself where it cannot (no
sudo, or macOS, where `git` is a stub that opens a GUI installer).
For a machine with nobody at the keyboard:
```sh
dotup --unattended # safe defaults, no UI, no prompt, no private tier
dotup --print # resolve everything and print the commands, install nothing
```
## What lands where
| Path | What |
|---|---|
| `~/.zshrc` | Plain file, no template, no secrets. One guarded `source` is the entire secret surface. |
| `~/.zshenv`, `~/.p10k.zsh` | Shell environment and prompt |
| `~/.config/nvim/**` | LazyVim, 36 files. `lua/plugins/image.lua` is the fragile one — see DESIGN §3 before touching it. |
| `~/.config/{gh,ghostty,git,btop,herdr}` | Terminal and tooling config |
| `~/.tmux.conf` → `~/.tmux/.tmux.conf` | Symlink into the gpakosz external |
| `~/.gitconfig` | No `[user]`. See "the seams" below. |
| `~/.local/bin/{dotup,sysjournal}` | The installer and the journal CLI |
| `~/.local/share/dotup/packages.tsv` | The manifest `dotup` reads |
## The seams
Three files this tier *reads* and never writes. Each is absent on a public-only
machine, and each absence is a silent no-op rather than an error.
| File | Written by | Carries |
|---|---|---|
| `~/.config/git/config.local` | private tier | `[user]`, signing key, Gitea host rewrites |
| `~/.config/zsh/local.zsh` | private tier | aliases naming hosts you own |
| `~/.config/zsh/secrets.zsh` | `dotsecrets`, from bws | the seven API keys, mode 600, in no repo |
If `git commit` says it does not know who you are, the private tier has not been
applied. That is the correct complaint, not a bug.
## Externals
Seven `git-repo` externals, none of which were declared anywhere before this repo
existed. That omission is why a clean bootstrap used to produce a broken login
shell: `.zshrc` sourced `$ZSH/oh-my-zsh.sh` with nothing having installed it.
`.tmux`, oh-my-zsh, powerlevel10k, zsh-autosuggestions, zsh-ai, and the tmux
plugins tmux-resurrect and tmux-continuum. The theme and both zsh plugins are
nested under `.oh-my-zsh/custom/`, which is what `$ZSH_CUSTOM` resolves to, and
the tmux plugins under `.tmux/plugins/`, where `.tmux.conf.local` loads them;
chezmoi processes externals in path order, so each parent is cloned first.
## dotup
One screen. Groups and packages are the same kind of row, both carry a tick box,
and every group opens into the packages underneath it. Group boxes are a
tri-state summary of their children, never an independent switch.
```
▸ [x] core 43/43 safe
▾ [~] media 2/3 safe
[x] ffmpeg apt ffmpeg
[ ] sox apt sox
[x] p7zip apt p7zip-full
▸ [ ] gpu 0/3 invasive kernel modules; a bad driver can bre…
▸ [ ] private 0/2 private one password, typed after the install…
space tick tab open ^t tick all shown ^a defaults ^x none ^o open all enter install
```
**One toggle rule, everywhere.** Expand the row to the packages it covers; if
every one is on, turn them all off, otherwise turn them all on. That single rule
covers a group row, a package row, and a bulk toggle over a filtered set — type
`nvidia`, press `^t`, and exactly the three rows you can see flip.
**The risk model.** `safe` is pre-ticked; `gui` is pre-ticked only where there
is a display; `invasive` is never ticked for you, and its reason is on the row;
`private` needs a password you type after the install finishes. A group's flag
is derived as the worst flag among its children, so a group can never look
safer than something inside it.
**Dependencies tick themselves.** `@needs` closure runs in both directions:
ticking `xrdp` ticks the `desktop` group it is useless without, and unticking
`core/node` drops `codex`, `pi`, `pi-plugins`, `mermaid-cli` and then `neovim`
— six rows including `node` itself. The closure is shown, not described: the
counts move on the same keystroke. `^t` is the one place the closure is
clipped: it follows `@needs` only as far as the first `invasive` row, so a bulk
toggle over a filter can never tick a root-equivalent daemon you were not
looking at — filter for `nvidia` and the docker group stays off. Press `^t`
again over the same rows and it hands back exactly what it took.
`^o` is a toggle, not "open all": press it again and everything closes. And on
the default collapsed screen every group row counts as "shown", so a single
`^t` there reaches all 86 packages — including the invasive and private ones.
That is the documented rule working as specified, but it is worth knowing
before you press it.
### The manifest
Five tab-separated columns, greppable by hand. Anything that would have been a
sixth column is an `@` directive instead:
```tsv
@needs core/neovim core/imagemagick core/mermaid-cli
@spec agents/codex @openai/codex
core neovim safe -tarball neovim apt ships 0.9.5 — tarball to /opt/nvim
core node safe -tarball node apt ships 18.19 and the npm rows need 20+
core fd safe fd-find fd binary is fdfind on ubuntu
```
A leading `-` in the apt or brew column means "not from this package manager":
`-tarball -npm -script -snap -deb -flatpak -uv -go -builtin -xcode`. A bare `-`
means unavailable there — and **Linux resolves apt-then-brew, not
apt-instead-of-brew**, because `omp`, `herdr` and `lazygit` have no apt package
at all — nor do `tea`, `bun` and `beads` — and `core/brew` is itself a `script`
row that all of them `@needs`, so ticking `lazygit` brings Homebrew with it. On Linux that means linuxbrew, under
`/home/linuxbrew/.linuxbrew`; `/usr/local` is not touched. Channel order is a
dependency graph and not a preference: `script` runs **before** `brew`, because
otherwise brew would still be missing when the rows needing it are attempted.
`go` runs after `tarball` and `brew`, the two places a go comes from, because
`core/go-tools` is `go install` of gopls, goimports, golangci-lint and
staticcheck into `~/go/bin`.
The installer probes `apt-cache policy` before it batches, and asks for the
installation *candidate* rather than merely whether the name is known: on stock
Ubuntu `apt-cache show nvidia-container-toolkit` prints nothing and **exits 0**,
so an existence test kept it in the batch, apt refused all thirty packages at
once, and the brew fallback was never reached. One unavailable name took thirty
installable ones down with it. A name with no candidate now moves to the brew
column instead.
**Docker is the case where that fallback was the wrong answer.** `docker-ce`,
`docker-buildx-plugin` and `docker-compose-plugin` exist only in Docker's own
apt repository, which nothing here configures — so all three had no candidate,
and the apt-then-brew rule sent a system daemon looking at Homebrew. The three
rows are a `script` channel now: on Linux Docker's own `get.docker.com`, the
vendor's supported route, which adds the repository and installs the engine
*and both plugins* in one pass; on macOS the Docker Desktop `.dmg` and its own
`Contents/MacOS/install`. The group still shows three members and still carries
its invasive warning, but `docker/docker-ce` is the row that does the work and
the other two report **its** outcome — "covered by" when it succeeded, "not
attempted" when it did not. What lands is the compose **plugin** —
`docker compose`. The deprecated standalone `docker-compose` v1 is never
fetched from anywhere.
Neither installer is piped into a shell. POSIX `sh` has no `pipefail`, so
`curl … | sh` exits with the *shell's* status: a download that 404s or is cut
off half way through reports success, the error path is unreachable, and
whatever fragment did arrive has already run as root. Both are downloaded into
the run's own `mktemp -d` directory, checked non-empty, and then executed from
there — and the `.dmg` is mounted read-only at a path inside that directory
rather than at `/Volumes/Docker`, which is a fixed name anyone able to mount an
image can occupy first. The presence check asks `docker buildx version` and
`docker compose version`, not merely whether a `docker` exists: `docker.io` and
`podman-docker` satisfy the latter while shipping neither plugin.
The other vendor scripts follow the same shape, without root: `agents/claude`
is Anthropic's native installer (`claude.ai/install.sh`, to `~/.local/bin`,
self-updating), and `core/rust` is rustup with `--no-modify-path`, because
`~/.zshenv` already sources `~/.cargo/env`. `apps/claude-desktop` on Linux adds
Anthropic's own apt repository — the docker trap again — and refuses the
signing key unless its fingerprint is the one Anthropic publishes; with no
`gpg` to check it, it installs nothing. On a Mac it is the `claude` cask.
The Nerd Font rows used to name `fonts-powerline`, which is the Powerline
glyphs only — not a Nerd Font — so the prompt and nvim's icons drew as tofu on
a fresh Linux box. On Linux they unpack the Nerd Fonts release into
`~/.local/share/fonts/NerdFonts/` and run `fc-cache`; on a Mac they are casks.
`@spec` carries the argument a channel needs but the package name cannot supply
— the scoped npm name, the flatpak app id, the `.deb` source. It defaults to the
package name.
### Where fzf comes from
The picker cannot get fzf from the manifest: it needs fzf to *draw* the
manifest. So it brings its own copy into `~/.cache/dotup/` and invokes it by
absolute path. **`PATH` is never modified and `~/.local/bin` is never written**
— a tool that refuses to tick `invasive` for you has no business quietly
shadowing your distro's fzf for Ctrl-R and the oh-my-zsh plugin. Your own fzf
wins whenever it clears the floor; nothing is replaced merely for being old.
Floor is 0.44.0, which is exactly where verification stops rather than where
compatibility breaks: every release from 0.29 up parses every binding used here,
but cursor-on-reload can only be *measured* from 0.44.1, where fzf's `--listen`
API began reporting state.
### The private tier
Ticking a `private` row schedules work, it does not do it — `git`, `chezmoi` and
`bws` have to exist first, and a password typed at picker time would sit in
memory through ten minutes of package downloads. So it happens at the end, and
never without a human:
```
prompt: URL · username · password the address is in no repo
│
├── blank ─▶ done. public-only machine. nothing was asked for.
├── 401 ─▶ say so, leave the machine public-only
└── 200 ─▶ two-line blob ─┬─ private repo → chezmoi init --apply
└─ bws token → ~/.config/bitwarden/bws-token (600)
```
The endpoint returns **data, never a script**: two `KEY=VALUE` lines,
`PRIVATE_REPO_URL=` and `BWS_ACCESS_TOKEN=`. Compromising it discloses two
revocable read-only credentials rather than executing arbitrary code as you on
every machine you ever build. The password is spent, never stored, and never
reaches `argv` — `curl -K -` reads it from stdin, so it never reaches `ps`
either.
The clone URL that comes back carries a read-only token inline, and it gets the
same treatment. The token is split out into
`~/.config/dotfiles/private-credentials` (mode 600, git-credential-store
format); `chezmoi init` receives a clean URL, and the helper is written into the
clone's own config so a later `chezmoi update` still authenticates. Not printing
it was never sufficient: `/proc/<pid>/cmdline` is world-readable, so passing the
credential-bearing URL to `chezmoi init` disclosed the token to every account on
the box for the length of the clone, and then persisted it in `.git/config`
until the tree was deleted. The redaction that predates this only ever covered
the trace line.
`dotup --unattended` cannot reach any of this. It has nobody to type a password,
and it refuses `private` and `invasive` rows outright even if a stale state file
ticks them.
## Tests
```sh
sh .tests/test.sh # here
sh .tests/test.sh --docker # clean ubuntu:24.04
DOTUP_TEST_IMAGE=ubuntu:22.04 sh .tests/test.sh --docker
DOTUP_TEST_IMAGE=debian:12 sh .tests/test.sh --docker
```
202 assertions covering the toggle rule, the `@needs` closure both ways, the risk
model as invariants rather than prose, match confinement (two-sided: `--exact`
confines `nvidia` to three rows **and** fuzzy still over-matches, so removing
`--exact` fails loudly), the fzf preflight, channel resolution on both
platforms, the installer, and that dotup runs at all as a non-root user with no
`sudo` on `PATH`.
The installer is driven against a directory of fake package managers that record
what they were asked to do and install nothing, so the engine is exercised end
to end without a single package landing on the machine running the suite.
The version spread is the point of the containers — this box runs fzf 0.72,
24.04 ships 0.44.1, 22.04 ships 0.29 and bookworm 0.38.
The macOS half of the manifest has no CI anywhere, so a fake `uname` stands in
for it. That is not theatre: it caught the apt/brew fallback running in both
directions, which resolved Linux-only packages to `apt install davfs2` on a
machine that has never had apt. The fallback is one-directional now.
### End to end
The suite above installs nothing. `.tests/e2e.sh` does the opposite — a stock
`ubuntu:24.04` container, the public tier fetched from the anonymous URL, then
the private tier through a real bootstrap endpoint, then `bws`, then a rendered
`secrets.zsh`.
```sh
bash .tests/e2e.sh # prompts for endpoint URL, username, password
```
The password is never written to disk and never placed on a command line: it
reaches the container as `docker exec -e BOOT_PW` with a bare name, which
inherits from the calling shell. `-e BOOT_PW=…` would put it in docker's own
argv, and `/proc/<pid>/cmdline` is world-readable — the same bug this repo was
fixed to stop committing itself.
It asserts what the unit suite structurally cannot: that a machine which has
only ever seen the public repo can authenticate, clone the private tier, and end
up with **no credential in its logs and none in `.git/config`**, with the token
in a 600-mode credential file that a later `fetch` still authenticates from.
**Without an endpoint password**, `.tests/e2e-mock-endpoint.py` stands in for
Caddy — 200 with the blob, 401 on bad credentials, and a closed connection on
any other path, which is what `handle { abort }` does and why a retired route
reports `000` rather than `404`. Everything downstream stays real. That is how
the argv fix was verified, and running it that way immediately caught a rotation
script whose route regex had stopped matching.
## Rules this repo lives by
- **Zero credentials, forever.** `gitleaks detect` runs over the full history
with no allowlist. The private repo gets exactly one allowlisted path; this one
gets none, and that asymmetry is the point.
- **Grep the files this repo owns, not `$HOME`.** A wholesale scan of a finished
machine is not a test of this repo: `~/.npm-global` ends up holding an AWS SDK
whose type definitions contain a literal `AKIA…` and an Anthropic SDK whose
docs contain `ghp_…`. Scope the scan to `chezmoi managed`, and tighten `sk-` to
`sk-[A-Za-z0-9_-]{20,}` — the bare substring matches `ask-`, `task-`, `risk-`
and `disk-`, and one of this manifest's own npm packages is called
`rpiv-ask-user-question`.
- **No identity.** No name, email, hostname, private IP or absolute home path.
If something needs one, it belongs behind a seam.
- **`.chezmoiignore` is gitignore syntax.** A `#` mid-line becomes part of the
pattern and silently matches nothing. Every comment goes on its own line.
- **Nothing invasive without an action of yours.** Not "never", since a `@needs`
edge can pull one in — but never silently, and never unattended.
-30
View File
@@ -1,30 +0,0 @@
#!/bin/sh
# bootstrap.sh -- the whole "first command" of a fresh machine, so nobody has
# to remember chezmoi's incantation. Everything after this is dotup's job.
#
# sh bootstrap.sh <public-repo-url> # or run it bare and answer the prompt
#
# This tier names no real host -- with exactly one exception, and it is this
# file naming ITS OWN clone URL. The exception discloses nothing: the only way
# to fetch this script is to already know the host it names. The endpoint host
# and everything else stay out, same as everywhere else in the tier.
set -u
DEFAULT_URL="https://git.djdadi.com/ben/dotfiles-public.git"
# An explicit argument wins outright -- including an explicit EMPTY one, which
# is an error rather than a silent fall-through to the default: the caller
# said "this one" and then named nothing.
if [ "$#" -ge 1 ]; then URL=$1; else URL=${DOTFILES_URL:-$DEFAULT_URL}; fi
[ -n "$URL" ] || { echo "usage: bootstrap.sh [public-repo-url]" >&2; exit 2; }
command -v curl >/dev/null 2>&1 \
|| { echo "bootstrap.sh: curl is required and not installed" >&2; exit 1; }
# Not fatal -- the public tier applies fine as root -- but brew-only packages
# (lazygit, omp, herdr) will refuse later, so say it now rather than then.
[ "$(id -u)" -ne 0 ] || echo "bootstrap.sh: running as root — Homebrew will refuse later; a normal user with sudo is the happy path" >&2
sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply "$URL" || exit 1
echo
echo "next: ~/.local/bin/dotup (full path — this shell's PATH predates the install)"
-129
View File
@@ -1,129 +0,0 @@
# Global Claude Configuration
@~/.claude/CLAUDE.personal.md
Write American English (behavior, color, gray, license).
## Tool Preferences
### Search & Navigation
- **Always use ripgrep** (`rg`) over grep for code search - it's faster and respects .gitignore
- **Use Grep tool** with specific patterns, not broad searches. Prefer `output_mode: "content"` with context lines when you need to understand surrounding code
- **Use Glob** for finding files by pattern, not `find` command
- **Prefer LSP** when available for: go-to-definition, find-references, rename symbols. The pyright-lsp and gopls-lsp plugins are enabled.
### Code Manipulation
- **Read before editing** - always read the full file (or relevant section) before making changes
- **Use code structure** over text patterns when possible:
- For function signatures: search for `func Name(` or `def name(`
- For type definitions: search for `type X struct` or `class X` or `interface X`
- For imports: check the import block at file top
- **Atomic edits** - make the smallest edit that accomplishes the goal. Don't rewrite surrounding code.
## Code Quality
- Prefer correct, complete implementations over minimal ones.
- Use appropriate data structures and algorithms — don't brute-force what has a known better solution.
- When fixing a bug, fix the root cause, not the symptom.
- If something I asked for requires error handling or validation to work reliably, include it without asking.
### Verification
- **Every change needs verification** - this is non-negotiable
- Verification can be:
- Running existing tests: `go test`, `pytest`, `npm test`
- Running a specific command that exercises the change
- Building the project to catch type/compile errors
- For frontend: screenshot comparison or playwright test
- **State verification method explicitly** in plans before implementing
### MCP Tools
- **Playwright** - use for frontend verification, taking screenshots, testing user flows
- Use MCP tools when they provide better precision than shell commands
## Workflow Principles
### Research First
Before proposing changes to unfamiliar code:
1. Identify the relevant files and their relationships
2. Understand existing patterns in that area
3. Check for similar implementations elsewhere in the codebase
4. Look for tests that document expected behavior
### Preserve Context
- Use subagents for exploratory searches (they don't pollute parent context)
- Compress findings into structured summaries
### routr
- When starting routr workers, ideally use **haiku or sonnet** for workers that run and
summarize tests. Keep the stronger model for the work that needs judgment.
### Dev servers
- **Always bind dev, desk and preview servers to `0.0.0.0`, never `127.0.0.1` or
`localhost`.** The user views them from another machine. This applies to every
server started for the user to look at, including test-harness servers. If the
app refuses non-loopback Host headers, turn that check off for the dev run too
(e.g. an `-allow-lan` flag). Report the URL with the host's LAN name or IP.
## Active Rule Sets
- common, golang, python, typescript, web
- C++ rules preserved at `rules/_inactive-cpp/` (not loaded)
Rule sets, specialized agents, skills and hooks are **not** in this public
repo. They come from the private dotfiles tier (`~/.claude/{agents,rules,skills}`,
`~/.codex/{skills,rules}`), and a machine with only the public tier has none of
them. This file is deliberately limited to system-level conventions that should
hold on any machine, including a throwaway one with nothing else configured.
## Shell
- Use zsh syntax when writing shell scripts or commands
- ~/.zshrc for shell configuration
## Anti-Patterns (Do Not)
- Don't search broadly then read dozens of files - be precise
- Don't make changes without reading the code first
- Don't skip verification
- Don't rewrite code that doesn't need to change
- Don't add comments, docstrings, or type annotations to unchanged code
## Obsidian vaults
`~/Documents/Obsidian-Work` and `~/Documents/Obsidian-Personal` are the user's
long-term memory. **Both vaults carry their own instructions, and those are
authoritative.** This file is per-machine and drifts; the vault copies sync.
- The **`obsidian-notes` skill** owns the protocol — `vault` and `sysjournal`
usage, recall-before-answering, folder ownership, guardrails.
- Each vault's **`Meta/Note Conventions.md`** owns its note rules, and they are
deliberately different between the two. Read with
`vault conventions --vault <work|personal>` before authoring anything
substantial.
Two things to know without reading anything:
1. **Recall first.** `vault search <terms>` before answering from scratch about a
work project or customer, the user's machines and home network, or anything
they may have solved before. Terms are ANDed — 2–3 specific words.
2. **Host/environment changes go to `sysjournal`, never `vault`.** The skill's
"Which tool" table draws the line and states the trigger.
`~/Documents/Obsidian25` is the pre-split original. It is **not** yet frozen: a
VPS cron still writes `_planning/`, `_agent/` and `Health/Garmin/` there nightly.
Never hand-write anywhere in it, and treat those three folders as owned by their
programs in every vault.
## Beads (`bd`)
Some repos track execution work in beads. A repo is wired in when `bd where` succeeds there.
- In a wired repo, the session-start hook injects the workflow from `.beads/PRIME.md`. If it is
missing from context — after compaction, or in a harness without the hook — run `bd prime`.
- Beads holds execution work: tasks, blockers, discovered follow-ups, handoff. Intent stays in
`.design/` when the repo has one; a bead never stands in for a plan.
- Memory stays where it is: the harness memory and the Obsidian vaults. Never `bd remember`.
- Beads syncs itself: each write pushes to origin, and the session-start hook pulls first. Don't
run `bd dolt push` by hand unless a sync failure was reported. At handoff, say which beads
changed.
- To wire a repo in, run `~/code/agent-templates/beads/setup <repo>` — never plain
`bd init`, which rewrites `AGENTS.md` and commits tool config.
-7
View File
@@ -1,7 +0,0 @@
{
"env": {
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.7-flash",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-4.7",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-4.6"
}
}
-139
View File
@@ -1,139 +0,0 @@
# Global Codex Configuration
## Tool Preferences
### Search And Navigation
- Always use `rg` over `grep` for code search.
- Prefer narrow searches over broad sweeps.
- Use precise file globs and code-aware navigation when available.
- Prefer MCP tools when they provide better precision than shell commands.
### Code Manipulation
- Read the relevant code before editing.
- Prefer structural understanding over blind text replacement.
- Make the smallest change that solves the problem.
- Do not rewrite surrounding code without a concrete reason.
### Verification
- Every change needs verification.
- Verification can be tests, a build, a targeted command, or frontend validation with Playwright.
- For non-trivial work, state the verification method before implementing.
## Language Patterns
### Python
- Prefer `black` or `ruff format` for formatting.
- Prefer `ruff` for linting.
- Use type hints on public code.
- Prefer `pytest`.
- Check for `.venv/` or `venv/` before assuming interpreter paths.
### Go
- Use `gofmt`.
- Prefer `go vet` for linting and `go test ./...` for verification.
- Check `go.mod` for module structure.
- Do not ignore errors with `_` unless there is a defensible reason.
### TypeScript
- Prefer `prettier` and `eslint` when present.
- Check `package.json` for the repo's actual test and build commands.
- Check `tsconfig.json` before changing compiler-sensitive code.
- Prefer strict typing patterns.
## Workflow Principles
### Research First
Before changing unfamiliar code:
1. Identify the relevant files and relationships.
2. Understand the local pattern in that area.
3. Check for similar implementations elsewhere.
4. Look for tests that define expected behavior.
### Plan Before Implement
For non-trivial work:
1. State what is changing and why.
2. Name the files or components likely to change.
3. Define how the change will be verified.
4. Note obvious risks or breakpoints.
### Preserve Context
- Keep findings compressed and structured.
- Reuse existing project artifacts like `.claude/progress.md`, `PITFALLS.md`, and project `CLAUDE.md` when they exist.
- If a repo already uses `.claude/` planning or checkpoint files, continue to respect them rather than inventing a second system.
## Session Workflow
### Starting A Session
1. Check for `.claude/progress.md` and load it as prior context when present.
2. Read `PITFALLS.md` if present.
3. Read project instructions from `AGENTS.md`. Codex is also configured to treat project `CLAUDE.md` as a fallback instruction file.
### During Work
- Research unfamiliar areas before editing.
- Make plans for non-trivial work.
- Review changes before commit when risk is non-trivial.
### Ending A Session
- If the repo uses `.claude/progress.md`, update it when useful.
- If there are uncommitted changes, leave the next session enough context to resume cleanly.
## Shell
- Use zsh-compatible syntax when writing shell commands or scripts.
- Assume `~/.zshrc` can affect shell behavior.
## Anti-Patterns
- Do not search broadly and read dozens of files without narrowing scope.
- Do not change code before understanding the local pattern.
- Do not skip verification.
- Do not rewrite code that does not need to change.
- Do not add comments, docstrings, or annotations to untouched code without a clear reason.
## Obsidian vaults
`~/Documents/Obsidian-Work` and `~/Documents/Obsidian-Personal` are the user's
long-term memory. **Both vaults carry their own instructions, and those are
authoritative.** This file is per-machine and drifts; the vault copies sync.
- The **`obsidian-notes` skill** owns the protocol — `vault` and `sysjournal`
usage, recall-before-answering, folder ownership, guardrails. If this agent
has not loaded it, read
`~/Documents/Obsidian-Personal/Meta/skills/obsidian-notes/SKILL.md`.
- Each vault's **`Meta/Note Conventions.md`** owns its note rules, and they are
deliberately different between the two. Read with
`vault conventions --vault <work|personal>` before authoring anything
substantial.
Two things to know without reading anything:
1. **Recall first.** `vault search <terms>` before answering from scratch about a
work project or customer, the user's machines and home network, or anything
they may have solved before. Terms are ANDed — 2–3 specific words.
2. **Host/environment changes go to `sysjournal`, never `vault`.** The skill's
"Which tool" table draws the line and states the trigger.
`~/Documents/Obsidian25` is the pre-split original. It is **not** yet frozen: a
VPS cron still writes `_planning/`, `_agent/` and `Health/Garmin/` there nightly.
Never hand-write anywhere in it, and treat those three folders as owned by their
programs in every vault.
## Dev servers
- **Always bind dev, desk and preview servers to `0.0.0.0`, never `127.0.0.1` or
`localhost`.** The user views them from another machine. This applies to every
server started for the user to look at, including test-harness servers. If the
app refuses non-loopback Host headers, turn that check off for the dev run too
(e.g. an `-allow-lan` flag). Report the URL with the host's LAN name or IP.
## Beads (`bd`)
Some repos track execution work in beads. A repo is wired in when `bd where` succeeds there.
- In a wired repo, the session-start hook injects the workflow from `.beads/PRIME.md`. If it is
missing from context — after compaction, or in a harness without the hook — run `bd prime`.
- Beads holds execution work: tasks, blockers, discovered follow-ups, handoff. Intent stays in
`.design/` when the repo has one; a bead never stands in for a plan.
- Memory stays where it is: the harness memory and the Obsidian vaults. Never `bd remember`.
- Beads syncs itself: each write pushes to origin, and the session-start hook pulls first. Don't
run `bd dolt push` by hand unless a sync failure was reported. At handoff, say which beads
changed.
- To wire a repo in, run `~/code/agent-templates/beads/setup <repo>` — never plain
`bd init`, which rewrites `AGENTS.md` and commits tool config.
-26
View File
@@ -1,26 +0,0 @@
; ~/.gitconfig — PUBLIC tier.
;
; Nothing here identifies you. Your name, your email, your signing key and the
; Gitea host rewrites are identity, not configuration, so they live in the
; private tier — which writes ~/.config/git/config.local. The include below is
; the seam between the two. Git treats a missing include as a no-op, so a
; public-only machine reads this file and stops.
;
; Do not add [user] here. If `git commit` complains that it does not know who
; you are, the private tier has not been applied, and that is the correct
; complaint.
[init]
defaultBranch = main
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
{{ if eq .chezmoi.os "darwin" }}
[credential]
helper = manager
{{ end }}
[include]
path = ~/.config/git/config.local
-17
View File
@@ -1,17 +0,0 @@
#!/bin/zsh
# Claude Desktop — isolated "personal" profile.
# --user-data-dir : separate Electron profile; also separates the
# single-instance lockfile, which is what allows a
# second concurrent instance to run at all.
# --password-store : app only auto-detects on KDE; XFCE would fall back
# to basic_text, where safeStorage is unavailable and
# OAuth tokens do not survive a restart.
# --class : distinct WM_CLASS so xfwm/taskbar treats the two
# windows as separate apps.
export CLAUDE_CONFIG_DIR="${CLAUDE_CONFIG_DIR:-$HOME/.claude}"
export PATH="$HOME/.local/share/claude-shims/personal:$PATH"
exec /usr/bin/claude-desktop \
--user-data-dir="$HOME/.local/share/claude-personal" \
--password-store=gnome-libsecret \
--class=ClaudePersonal \
"$@"
@@ -1,45 +0,0 @@
#!/bin/zsh
# Routes claude:// URLs (OAuth callbacks, deep links) to the correct profile.
#
# The packaged entry runs plain `claude-desktop %U` with no flags, which
# starts an unflagged default-profile instance that has no keyring backend
# and cannot save the sign-in. This picks the right profile instead.
#
# Ordering:
# 1. A fresh hint written by that profile's xdg-open shim when the app
# opened the browser -- this is the authoritative signal, and it is
# consumed on use so it can never misroute a later link.
# 2. Whichever profile is the only one running.
# 3. The most recently started instance, else personal.
#
# Handing the URL to the profile wrapper is safe: Electron's second-instance
# handler forwards it into the running instance with that --user-data-dir.
url="$1"
hint="$HOME/.config/claude-profile-target"
HINT_MAX_AGE=600 # seconds; ignore an abandoned sign-in attempt
running() { pgrep -f -- "--user-data-dir=$HOME/.local/share/claude-$1" >/dev/null 2>&1 }
target=""
if [[ -r "$hint" ]]; then
age=$(( $(date +%s) - $(stat -c %Y "$hint") ))
if (( age <= HINT_MAX_AGE )); then
candidate="$(<"$hint")"
[[ "$candidate" == (personal|work) ]] && target="$candidate"
fi
rm -f "$hint"
fi
if [[ -z "$target" ]]; then
if running personal && ! running work; then
target=personal
elif running work && ! running personal; then
target=work
else
target=$(for p in personal work; do
pid=$(pgrep -f -- "--user-data-dir=$HOME/.local/share/claude-$p" | head -1)
[[ -n "$pid" ]] && echo "$(ps -o lstart= -p $pid | xargs -I{} date -d {} +%s) $p"
done | sort -rn | head -1 | cut -d' ' -f2)
target="${target:-personal}"
fi
fi
exec "$HOME/.local/bin/claude-$target" "$url"
-17
View File
@@ -1,17 +0,0 @@
#!/bin/zsh
# Claude Desktop — isolated "work" profile.
# --user-data-dir : separate Electron profile; also separates the
# single-instance lockfile, which is what allows a
# second concurrent instance to run at all.
# --password-store : app only auto-detects on KDE; XFCE would fall back
# to basic_text, where safeStorage is unavailable and
# OAuth tokens do not survive a restart.
# --class : distinct WM_CLASS so xfwm/taskbar treats the two
# windows as separate apps.
export CLAUDE_CONFIG_DIR="${CLAUDE_CONFIG_DIR:-$HOME/.claude-work}"
export PATH="$HOME/.local/share/claude-shims/work:$PATH"
exec /usr/bin/claude-desktop \
--user-data-dir="$HOME/.local/share/claude-work" \
--password-store=gnome-libsecret \
--class=ClaudeWork \
"$@"
File diff suppressed because it is too large. Load diff
-31
View File
@@ -1,31 +0,0 @@
#!/bin/sh
# mermaid-cli with the puppeteer config that passes --no-sandbox to headless
# Chromium. Ubuntu 24.04's AppArmor userns restriction kills Chromium's own
# sandbox, so without this nvim's mermaid rendering fails.
#
# It execs the real mmdc found later on PATH (the npm-global install), skipping
# itself. A bare `mmdc` reaches this wrapper only if ~/.local/bin comes before
# the npm-global bin on PATH, which is the order .zshrc sets.
set -eu
self=$(cd "$(dirname "$0")" && pwd -P)/$(basename "$0")
real=
IFS=:
for d in $PATH; do
[ -n "$d" ] || continue
c=$d/mmdc
[ -f "$c" ] || continue
[ -x "$c" ] || continue
[ "$(cd "$d" && pwd -P)/mmdc" = "$self" ] && continue
real=$c
break
done
unset IFS
[ -n "$real" ] || { echo "mmdc: mermaid-cli is not installed (no other mmdc on PATH)" >&2; exit 127; }
cfg=${XDG_CONFIG_HOME:-$HOME/.config}/mermaid/puppeteer-config.json
if [ -r "$cfg" ]; then
exec "$real" -p "$cfg" "$@"
fi
exec "$real" "$@"
-183
View File
@@ -1,183 +0,0 @@
#!/usr/bin/env bash
# sysjournal — shared system-knowledge journal for the Obsidian vault.
#
# One tool, used by every coding agent (Claude Code, Codex, Pi), so host/
# environment changes get recorded in ONE consistent, greppable place with
# the frontmatter schema that "Tech/Infrastructure/System Log MOC.md" indexes
# via Dataview (date, machine, type, status, tags, review-by).
#
# Journal HOST/ENVIRONMENT changes — system config, services, networking,
# VMs, drivers, build toolchains, host-wiring of an app. NOT ordinary work
# inside a code repo. See `sysjournal help`.
#
# Portable bash (invoked by agents in varied environments), not zsh.
set -euo pipefail
# Vault location. SYSJOURNAL_VAULT always wins; otherwise take the first
# candidate on this machine that is an Obsidian vault (has a .obsidian dir).
# The split-off personal vault comes first: Obsidian Sync landed it as
# Obsidian-Personal on Linux but as plain "Personal" on the MacBook. The
# pre-split vault is the fallback for machines that have not synced the split
# yet, named Obsidian25 on Linux but Obsidian2 on the MacBook. Requiring
# .obsidian stops a generic ~/Documents/Personal folder from being mistaken
# for a vault, and stops the MacBook's stale Obsidian2 from winning.
sysjournal_default_vault() {
local c
for c in "Obsidian-Personal" "Personal" "Obsidian25" "Obsidian2"; do
[ -d "$HOME/Documents/$c/.obsidian" ] && { printf '%s' "$HOME/Documents/$c"; return; }
done
printf '%s' "$HOME/Documents/Obsidian-Personal" # for the error message
}
VAULT="${SYSJOURNAL_VAULT:-$(sysjournal_default_vault)}"
SUBDIR="${SYSJOURNAL_SUBDIR:-Tech/Infrastructure}"
INFRA="$VAULT/$SUBDIR"
die() { printf 'sysjournal: %s\n' "$*" >&2; exit 1; }
ensure_dir() {
[ -d "$VAULT" ] || die "vault not found: $VAULT (set SYSJOURNAL_VAULT)"
mkdir -p "$INFRA"
}
usage() {
cat <<'EOF'
sysjournal — record & recall host/environment changes in the Obsidian vault.
USAGE
sysjournal search <keywords...> Recall: grep the journal first (case-insensitive)
sysjournal new "<Title>" [options] Scaffold a new note, print its path
sysjournal list [N] List the N most-recent notes (default 20)
sysjournal path Print the infrastructure folder path
sysjournal help This help
`new` OPTIONS
--type <t> change | setup | debug | fix | incident | note (default: change)
--status <s> deployed | resolved | unresolved | workaround | planned (default: deployed)
--tags a,b,c comma-separated tags
--machine <m> host the change was made on (default: `hostname -s`)
--review-by <YYYY-MM-DD> optional follow-up/expiry date
--summary "<one line>" optional lead line
WHAT TO JOURNAL
YES system config, services/daemons (systemd/launchd/cron), networking/DNS/
VPN/firewall, VMs & host containers, drivers/kernel/boot, disks/mounts,
build toolchains & global package installs, wiring an app into the host.
NO feature work, bug fixes, refactors, tests INSIDE a project repo.
Discriminator: does it change state outside the repo, on the host? If no, skip.
Straddle (build an app AND install it as a service): journal only the
host-wiring part (the unit/cron/port), not the app code.
EXAMPLES
sysjournal search systemd relay port
sysjournal new "WireGuard VPN to homelab" --type setup --tags wireguard,vpn,network
sysjournal new "DNS resolution flaky after netplan change" --type debug --status unresolved
EOF
}
cmd_search() {
ensure_dir
[ "$#" -ge 1 ] || die "search needs at least one keyword"
# OR-match the keywords so a few loosely-related terms still surface notes.
local pattern
pattern=$(printf '%s|' "$@"); pattern="${pattern%|}"
echo "# Journal matches in $SUBDIR for: $*"
echo
if ! rg -i --no-heading -n -C1 --color never -e "$pattern" "$INFRA" 2>/dev/null; then
echo "(no matches — nothing journaled on this yet)"
fi
}
cmd_list() {
ensure_dir
local n="${1:-20}"
# Newest first by mtime; strip the vault prefix for readability.
find "$INFRA" -maxdepth 1 -name '*.md' -printf '%T@ %p\n' 2>/dev/null \
| sort -rn | head -n "$n" | sed "s#[0-9.]* $INFRA/##"
}
cmd_path() { echo "$INFRA"; }
cmd_new() {
ensure_dir
local title="" type="change" status="deployed" tags="" machine review_by="" summary=""
machine="$(hostname -s 2>/dev/null || hostname)"
# First non-flag arg is the title.
while [ "$#" -gt 0 ]; do
case "$1" in
--type) type="${2:?--type needs a value}"; shift 2;;
--status) status="${2:?--status needs a value}"; shift 2;;
--tags) tags="${2:?--tags needs a value}"; shift 2;;
--machine) machine="${2:?--machine needs a value}"; shift 2;;
--review-by) review_by="${2:?--review-by needs a value}"; shift 2;;
--summary) summary="${2:?--summary needs a value}"; shift 2;;
--*) die "unknown option: $1";;
*) [ -z "$title" ] && title="$1" || die "unexpected arg: $1"; shift;;
esac
done
[ -n "$title" ] || die 'new needs a "<Title>"'
# Filename: keep the human title (Obsidian-friendly), drop only path-illegal chars.
local fname; fname=$(printf '%s' "$title" | tr '/\\' '--' | sed 's/[[:cntrl:]]//g; s/ */ /g; s/^ *//; s/ *$//')
local file="$INFRA/$fname.md"
if [ -e "$file" ]; then
echo "$file" # already exists — recall, don't clobber; edit/append this note.
echo "sysjournal: note already exists — edit it instead of creating a duplicate." >&2
return 0
fi
# YAML frontmatter — inline tag list, matching the MOC's own `tags: [moc]` style.
local yaml_tags="[]"
if [ -n "$tags" ]; then
yaml_tags="[$(printf '%s' "$tags" | sed 's/ *, */, /g')]"
fi
local date_today; date_today="$(date +%F)"
{
echo "---"
echo "date: $date_today"
echo "machine: $machine"
echo "type: $type"
echo "status: $status"
echo "tags: $yaml_tags"
[ -n "$review_by" ] && echo "review-by: $review_by"
echo "---"
echo
echo "# $title"
echo
[ -n "$summary" ] && { echo "$summary"; echo; }
echo "## Why"
echo
echo "## What changed"
echo
echo "## Design decisions / gotchas"
echo
echo "## Verify"
echo
echo '```'
echo '# command run + observed result'
echo '```'
echo
echo "## Status / follow-ups"
echo
echo "Related: "
} > "$file"
echo "$file"
}
main() {
local sub="${1:-help}"; shift || true
case "$sub" in
search|recall|grep) cmd_search "$@";;
new|add) cmd_new "$@";;
list|ls) cmd_list "$@";;
path|dir) cmd_path;;
help|-h|--help) usage;;
*) usage; die "unknown command: $sub";;
esac
}
main "$@"
-9
View File
@@ -1,9 +0,0 @@
{{- /* The personal vault is Obsidian-Personal on Linux but "Personal" on the
MacBook (Obsidian Sync named it there). Same rule as sysjournal: first
candidate that is a vault wins, Obsidian-Personal when neither is. */ -}}
{{- $docs := joinPath .chezmoi.homeDir "Documents" -}}
{{- $vault := joinPath $docs "Obsidian-Personal" -}}
{{- if and (not (stat (joinPath $vault ".obsidian"))) (stat (joinPath $docs "Personal" ".obsidian")) -}}
{{- $vault = joinPath $docs "Personal" -}}
{{- end -}}
{{ $vault }}/Meta/bin/vault
@@ -1,10 +0,0 @@
[Desktop Entry]
Name=Claude (Personal)
Comment=Claude Desktop — personal account
GenericName=AI Assistant
Exec={{ .chezmoi.homeDir }}/.local/bin/claude-personal %U
Icon=claude-desktop
Type=Application
StartupNotify=true
StartupWMClass=ClaudePersonal
Categories=Utility;Development;
@@ -1,6 +0,0 @@
[Desktop Entry]
Name=Claude (profile-aware link handler)
Exec={{ .chezmoi.homeDir }}/.local/bin/claude-url-dispatch %u
Type=Application
NoDisplay=true
MimeType=x-scheme-handler/claude;
@@ -1,10 +0,0 @@
[Desktop Entry]
Name=Claude (Work)
Comment=Claude Desktop — work account
GenericName=AI Assistant
Exec={{ .chezmoi.homeDir }}/.local/bin/claude-work %U
Icon=claude-desktop
Type=Application
StartupNotify=true
StartupWMClass=ClaudeWork
Categories=Utility;Development;
@@ -1,7 +0,0 @@
[Desktop Entry]
Name=Claude Code URL Handler
Comment=Handle claude-cli:// deep links for Claude Code
Exec="{{ .chezmoi.homeDir }}/.local/bin/claude" --handle-uri %u
Type=Application
NoDisplay=true
MimeType=x-scheme-handler/claude-cli;
@@ -1,7 +0,0 @@
#!/bin/sh
# PATH shim, injected only into the "personal" Claude instance.
# Electron shells out to xdg-open (via PATH) to open the browser for
# sign-in. Recording the profile here is what lets the claude:// callback
# find its way back to the instance that actually started the login.
printf '%s' "personal" > "$HOME/.config/claude-profile-target" 2>/dev/null
exec /usr/bin/xdg-open "$@"
@@ -1,7 +0,0 @@
#!/bin/sh
# PATH shim, injected only into the "work" Claude instance.
# Electron shells out to xdg-open (via PATH) to open the browser for
# sign-in. Recording the profile here is what lets the claude:// callback
# find its way back to the instance that actually started the login.
printf '%s' "work" > "$HOME/.config/claude-profile-target" 2>/dev/null
exec /usr/bin/xdg-open "$@"
-166
View File
@@ -1,166 +0,0 @@
#group pkg flag apt brew note
#
# Five columns, tab separated, greppable by hand. Anything that would have been
# a sixth column is an @ directive instead, so a package with no dependency and
# no install argument -- most of them -- costs nothing to read.
#
# @needs <group/pkg> <dep>... dep is group/pkg or a whole group.
# Closure is transitive in both directions.
# @spec <group/pkg> <arg>... Argument for a channel that cannot be named
# by the package: the npm spec, the flatpak
# app id, the .deb source. Defaults to the
# package name when absent.
# @<group> <note> Group note. Only needed where the members
# fail the safe test for different reasons;
# otherwise the worst child's note is right.
#
# A leading `-` in the apt or brew column means "not from this package manager":
# -tarball -npm -script -snap -deb -flatpak -uv -go -builtin -xcode.
# A bare `-` means unavailable there. Linux falls back to the brew column before
# giving up -- omp, herdr and lazygit have no apt package at all. The fallback is
# one-directional: there is no apt on a Mac, so a `-` in the brew column is the
# end of the road rather than a reason to read a column of Debian package names.
#
@needs networking/xrdp desktop
@needs networking/xorgxrdp desktop
@needs gpu/container-toolkit docker
@needs agents/codex core/node
@needs agents/pi core/node
@needs agents/pi-plugins core/node
@needs agents/pi-plugins agents/pi
@needs core/mermaid-cli core/node
@needs core/tree-sitter core/node
# The three rows with no apt package at all. They resolved to brew and
# nothing installed brew, so `^a` ticked them and they failed on every
# fresh Linux box. On Linux brew lives entirely under
# /home/linuxbrew/.linuxbrew, which find_tool already probes.
@needs core/lazygit core/brew
@needs agents/omp core/brew
@needs agents/herdr core/brew
@needs agents/beads core/brew
@needs core/tea core/brew
@needs core/bun core/brew
# `go install` needs a go. The -go channel runs after the tarball one, so the
# order is right on Linux; on a Mac go comes from brew, which runs first too.
@needs core/go-tools core/go
# The Nerd Fonts release is .tar.xz, and the 24.04 base image has no xz.
@needs fonts/hack-nerd-font core/xz
@needs fonts/iosevka-nerd-font core/xz
@needs core/neovim core/imagemagick core/mermaid-cli
@needs private/bws-secrets core/unzip
#
# npm names carry scopes that the plugin's short name does not. `npm i -g
# rpiv-btw` installs somebody else's package.
@spec agents/codex @openai/codex
@spec agents/pi @earendil-works/pi-coding-agent
@spec agents/pi-plugins @juicesharp/rpiv-ask-user-question @juicesharp/rpiv-btw @juicesharp/rpiv-todo @samfp/pi-memory @tmustier/pi-ralph-wiggum pi-markdown-preview pi-powerline-footer pi-simplify pi-subagents pi-web-access pi-lens pi-mcp-adapter
@spec core/mermaid-cli @mermaid-js/mermaid-cli
@spec core/tree-sitter tree-sitter-cli
@spec core/bitwarden-cli bw
@spec apps/obsidian md.obsidian.Obsidian
@spec apps/signal org.signal.Signal
@spec apps/chrome https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
@spec apps/ghostty gh:mkasberg/ghostty-ubuntu:_%a_%v.deb
core neovim safe -tarball neovim apt ships 0.9.5 — tarball to /opt/nvim
core ripgrep safe ripgrep ripgrep binary is rg
core fd safe fd-find fd binary is fdfind on ubuntu
core bat safe bat bat binary is batcat on ubuntu
core fzf safe fzf fzf for your shell (ctrl-r); the picker uses its own pinned copy
core eza safe eza eza
core zsh safe zsh -builtin login shell everywhere
core tmux safe tmux tmux
core git-lfs safe git-lfs git-lfs
core lazygit safe - lazygit no apt package
core gh safe gh gh
core chezmoi safe -script chezmoi bootstrap cannot come from the manifest
core go safe -tarball go /usr/local/go on linux
core uv safe -script uv astral installer to ~/.local/bin
core brew safe -script -script linuxbrew — the only source for lazygit, omp and herdr
core node safe -tarball node apt ships 18.19 and the npm rows below need 20+ — tarball to /opt/node
core imagemagick safe imagemagick imagemagick required by the nvim markdown render path
core mermaid-cli safe -npm -npm mmdc — nvim renders mermaid fences with it
core tree-sitter safe -npm -npm tree-sitter CLI — nvim-treesitter (main) refuses to start without it
core btop safe btop btop
core htop safe htop htop
core ncdu safe ncdu ncdu
core xz safe xz-utils xz the Nerd Fonts release is .tar.xz, and 24.04 minimal has no xz
core unzip safe unzip unzip the bws release ships as a .zip, and 24.04 minimal has no unzip
core tree safe tree tree
core cmake safe cmake cmake
core ninja safe ninja-build ninja package name differs from binary
core build-tools safe build-essential -xcode
core magic-wormhole safe magic-wormhole magic-wormhole snap wormhole on dev
core bitwarden-cli safe -snap bitwarden-cli snap bw on ubuntu
core mosh safe mosh mosh
core nmap safe nmap nmap
core wakeonlan safe wakeonlan wakeonlan for the wakeup_tv alias in the private tier's local.zsh
core binwalk safe binwalk binwalk
core pipx safe pipx pipx
core age safe age age general purpose only now
core jq safe jq jq every Claude hook and the beads session hook pipe through it
core shellcheck safe shellcheck shellcheck the installer itself is linted with it
core clang-format safe clang-format clang-format
core gitleaks safe gitleaks gitleaks the pre-commit secret scan this repo's rules require
core tea safe - tea Gitea CLI — no apt package, pulls linuxbrew on linux
core bun safe - oven-sh/bun/bun builds the statusline — tap only, pulls linuxbrew on linux
core go-tools safe -go -go gopls goimports golangci-lint staticcheck — go install to ~/go/bin
core rust safe -script -script rustup to ~/.cargo, PATH left alone — ~/.zshenv sources ~/.cargo/env
agents codex safe -npm -npm @openai/codex — unpinned, always latest
agents pi safe -npm -npm @earendil-works/pi-coding-agent
agents pi-plugins safe -npm -npm 12 plugins: rpiv-*, pi-memory, pi-subagents, pi-lens, pi-mcp-adapter, ...
agents omp safe - can1357/tap/omp oh my pi — tap only, pulls linuxbrew on linux
agents herdr safe - herdr terminal workspace manager for agents
agents claude safe -script -script Claude Code, Anthropic's native installer to ~/.local/bin — updates itself
agents beads safe - beads bd — the brew formula pulls dolt, its backend
fonts hack-nerd-font safe -tarball font-hack-nerd-font Nerd Fonts release to ~/.local/share/fonts on linux
fonts iosevka-nerd-font safe -tarball font-iosevka-nerd-font Nerd Fonts release to ~/.local/share/fonts on linux
media ffmpeg safe ffmpeg ffmpeg
media sox safe sox sox
media p7zip safe p7zip-full p7zip
apps obsidian gui -flatpak obsidian
apps ghostty gui -deb ghostty
apps chrome gui -deb google-chrome
apps firefox gui firefox firefox
apps vlc gui vlc vlc
apps claude-desktop gui -script claude adds Anthropic's apt repository and signing key on linux
apps signal gui -flatpak signal flathub org.signal.Signal, --user on linux
@networking daemons, listening ports, and setuid mount helpers
networking openssh-server invasive openssh-server -builtin opens port 22 on every network this box can reach
networking tailscale invasive tailscale tailscale daemon; joins a private network and rewrites DNS
networking avahi-daemon invasive avahi-daemon - daemon; broadcasts this host on the LAN
networking xrdp invasive xrdp - opens port 3389 · useless without the desktop group
networking xorgxrdp invasive xorgxrdp - xrdp's X backend
networking nfs-common invasive nfs-common - setuid mount helper
networking cifs-utils invasive cifs-utils - setuid mount helper
networking davfs2 invasive davfs2 - setuid mount helper
@docker daemon; membership in the docker group is root-equivalent
# Docker's own apt repository, not Ubuntu's. `docker-ce`, `docker-buildx-plugin`
# and `docker-compose-plugin` live in download.docker.com/linux/<distro>, which
# nothing here configures — so on a stock box every one of these names had no
# installation candidate, install_apt's unknown-name path fired, and a Linux
# daemon went looking in the brew column. get.docker.com adds the repository and
# installs the engine and BOTH plugins in one pass, so all three rows are one
# install: see install_bespoke's docker branch. Never brew, and never the
# deprecated standalone docker-compose v1 — `docker compose` is the plugin.
docker docker-ce invasive -script -script daemon; docker group is root-equivalent · installs from get.docker.com, never brew
docker docker-buildx invasive -script -script buildx plugin — get.docker.com installs it alongside docker-ce
docker docker-compose invasive -script -script the compose plugin, run as `docker compose` — from get.docker.com, never the deprecated v1 binary
@desktop changes the display manager — can leave you at a black screen
desktop xfce4 invasive xfce4 - changes the display manager
desktop lightdm invasive lightdm - CAN LEAVE YOU AT A BLACK SCREEN
@gpu kernel modules; a bad driver can break boot
gpu nvidia-driver invasive nvidia-driver-570 - kernel modules; can break boot
gpu cuda-toolkit invasive nvidia-cuda-toolkit -
gpu container-toolkit invasive nvidia-container-toolkit - requires docker
@virt daemon, bridges, and group membership
virt qemu invasive qemu-kvm -
virt libvirt invasive libvirt-daemon-system - daemon + group membership
virt virt-manager invasive virt-manager -
virt incus invasive incus - daemon; incus-admin membership is root-equivalent · the test-VM tool
# The rows above host guests; these two ARE the guest. Both ship in
# Ubuntu main — plain apt names, no vendor repository involved.
virt guest-agent invasive qemu-guest-agent - daemon the qemu HOST can command (shutdown, fsfreeze) — for when this box is the guest
virt spice-vdagent invasive spice-vdagent - guest clipboard/resolution under SPICE graphics · useless outside a VM
@private one password, typed after the install finishes
private private-repo private - - ~/.local/share/dotfiles-private — agent config, ssh config
private bws-secrets private - - bws + 7 API keys into ~/.config/zsh/secrets.zsh; the tier installs bws itself
Can't render this file because it contains an unexpected character in line 17 and column 49.
-61
View File
@@ -1,61 +0,0 @@
# Global Pi Configuration
Global instructions for the Pi coding agent, shared with the Claude Code and
Codex setups on this machine. Project-level `AGENTS.md` / `CLAUDE.md` files take
precedence for project-specific work.
## Shell
- Use zsh-compatible syntax when writing shell commands or scripts.
- Assume `~/.zshrc` can affect shell behavior.
## Obsidian vaults
`~/Documents/Obsidian-Work` and `~/Documents/Obsidian-Personal` are the user's
long-term memory. **Both vaults carry their own instructions, and those are
authoritative.** This file is per-machine and drifts; the vault copies sync.
- The **`obsidian-notes` skill** owns the protocol — `vault` and `sysjournal`
usage, recall-before-answering, folder ownership, guardrails. If this agent
has not loaded it, read
`~/Documents/Obsidian-Personal/Meta/skills/obsidian-notes/SKILL.md`.
- Each vault's **`Meta/Note Conventions.md`** owns its note rules, and they are
deliberately different between the two. Read with
`vault conventions --vault <work|personal>` before authoring anything
substantial.
Two things to know without reading anything:
1. **Recall first.** `vault search <terms>` before answering from scratch about a
work project or customer, the user's machines and home network, or anything
they may have solved before. Terms are ANDed — 2–3 specific words.
2. **Host/environment changes go to `sysjournal`, never `vault`.** The skill's
"Which tool" table draws the line and states the trigger.
`~/Documents/Obsidian25` is the pre-split original. It is **not** yet frozen: a
VPS cron still writes `_planning/`, `_agent/` and `Health/Garmin/` there nightly.
Never hand-write anywhere in it, and treat those three folders as owned by their
programs in every vault.
## Dev servers
- **Always bind dev, desk and preview servers to `0.0.0.0`, never `127.0.0.1` or
`localhost`.** The user views them from another machine. This applies to every
server started for the user to look at, including test-harness servers. If the
app refuses non-loopback Host headers, turn that check off for the dev run too
(e.g. an `-allow-lan` flag). Report the URL with the host's LAN name or IP.
## Beads (`bd`)
Some repos track execution work in beads. A repo is wired in when `bd where` succeeds there.
- In a wired repo, the session-start hook injects the workflow from `.beads/PRIME.md`. If it is
missing from context — after compaction, or in a harness without the hook — run `bd prime`.
- Beads holds execution work: tasks, blockers, discovered follow-ups, handoff. Intent stays in
`.design/` when the repo has one; a bead never stands in for a plan.
- Memory stays where it is: the harness memory and the Obsidian vaults. Never `bd remember`.
- Pi has no session-start hook: in a wired repo, run `bd dolt pull` and then `bd prime` before
anything else.
- Beads syncs itself: each write pushes to origin, and the session-start hook pulls first. Don't
run `bd dolt push` by hand unless a sync failure was reported. At handoff, say which beads
changed.
- To wire a repo in, run `~/code/agent-templates/beads/setup <repo>` — never plain
`bd init`, which rewrites `AGENTS.md` and commits tool config.
-192
View File
@@ -1,192 +0,0 @@
{
"providers": {
"openrouter": {
"apiKey": "$OPENROUTER_API_KEY",
"models": [
{
"id": "deepseek/deepseek-v4-pro",
"name": "DeepSeek V4 Pro (OpenRouter)",
"reasoning": true,
"input": [
"text"
],
"contextWindow": 1048576,
"maxTokens": 384000,
"cost": {
"input": 0.2088,
"output": 0.4176,
"cacheRead": 0.0174,
"cacheWrite": 0
}
},
{
"id": "deepseek/deepseek-v4-flash",
"name": "DeepSeek V4 Flash (OpenRouter)",
"reasoning": true,
"input": [
"text"
],
"contextWindow": 1048576,
"maxTokens": 943717,
"cost": {
"input": 0.091,
"output": 0.182,
"cacheRead": 0.0182,
"cacheWrite": 0
}
},
{
"id": "moonshotai/kimi-k3.1-pro",
"name": "Kimi K3.1 Pro (OpenRouter)",
"reasoning": true,
"input": [
"text",
"image"
],
"contextWindow": 1048576,
"maxTokens": 943718,
"cost": {
"input": 2,
"output": 10,
"cacheRead": 0.2,
"cacheWrite": 0
}
},
{
"id": "qwen/qwen4-max",
"name": "Qwen4 Max (OpenRouter)",
"reasoning": true,
"input": [
"text",
"image"
],
"contextWindow": 1000000,
"maxTokens": 131072,
"cost": {
"input": 1.425,
"output": 4.275,
"cacheRead": 0.07125,
"cacheWrite": 1.78125
}
}
]
},
"deepseek": {
"baseUrl": "https://api.deepseek.com",
"api": "openai-completions",
"apiKey": "$DEEPSEEK_API_KEY",
"compat": {
"thinkingFormat": "deepseek"
},
"models": [
{
"id": "deepseek-v4-pro",
"name": "DeepSeek V4 Pro",
"reasoning": true,
"input": ["text"],
"contextWindow": 1000000,
"maxTokens": 65536,
"cost": { "input": 1.32, "output": 3.96, "cacheRead": 0.044, "cacheWrite": 0 }
},
{
"id": "deepseek-v4-flash",
"name": "DeepSeek V4 Flash",
"reasoning": true,
"input": ["text"],
"contextWindow": 1000000,
"maxTokens": 65536,
"cost": { "input": 0.14, "output": 0.28, "cacheRead": 0.0028, "cacheWrite": 0 }
}
]
},
"zai": {
"baseUrl": "https://api.z.ai/api/coding/paas/v4",
"api": "openai-completions",
"apiKey": "$ZAI_API_KEY",
"compat": {
"supportsDeveloperRole": false,
"thinkingFormat": "zai"
},
"models": [
{
"id": "glm-4.6",
"name": "GLM-4.6 (Coding)",
"reasoning": true,
"input": ["text"],
"contextWindow": 200000,
"maxTokens": 131072,
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
},
{
"id": "glm-5.3",
"name": "GLM-5.3 (Coding)",
"reasoning": true,
"thinkingLevelMap": {
"off": null,
"minimal": null,
"low": "low",
"medium": null,
"high": "high",
"xhigh": null,
"max": "max"
},
"input": ["text"],
"contextWindow": 1000000,
"maxTokens": 131072,
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"compat": {
"supportsStore": false,
"supportsReasoningEffort": true,
"maxTokensField": "max_tokens",
"supportsStrictMode": true,
"zaiToolStream": true
}
},
{
"id": "glm-5.3-flash",
"name": "GLM-5.3 Flash (Coding)",
"reasoning": true,
"thinkingLevelMap": {
"off": null,
"minimal": null,
"low": "low",
"medium": null,
"high": "high",
"xhigh": null,
"max": "max"
},
"input": ["text", "image"],
"contextWindow": 1000000,
"maxTokens": 131072,
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"compat": {
"supportsStore": false,
"supportsReasoningEffort": true,
"maxTokensField": "max_tokens",
"supportsStrictMode": true,
"zaiToolStream": true
}
}
]
},
"local-lmstudio": {
"baseUrl": "http://localhost:1234/v1",
"api": "openai-completions",
"apiKey": "lmstudio",
"compat": {
"supportsDeveloperRole": false,
"supportsReasoningEffort": false
},
"models": [
{
"id": "qwen3.6-27b-uncensored-heretic-v2-native-mtp-preserved",
"name": "Qwen 3.6 27B Uncensored Heretic v2 (Local)",
"reasoning": true,
"input": ["text"],
"contextWindow": 38000,
"maxTokens": 32000
}
]
}
}
}
-531
View File
@@ -1,531 +0,0 @@
# --- clipboard: allow OSC 52 passthrough from nvim ---
set -g allow-passthrough on #!important
set -s set-clipboard on #!important
# --- claude-managed: session persistence ---
set -g @continuum-restore 'on'
set -g @resurrect-capture-pane-contents 'on'
run-shell ~/.tmux/plugins/tmux-resurrect/resurrect.tmux
run-shell ~/.tmux/plugins/tmux-continuum/continuum.tmux
# : << 'EOF'
# Oh my tmux!
# 💛🩷💙🖤❤️🤍
# https://github.com/gpakosz/.tmux
# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license,
# without any warranty.
# Copyright 2012— Gregory Pakosz (@gpakosz).
# -- bindings ------------------------------------------------------------------
# preserve tmux stock bindings,
# while adding bindings that don't conflict with these stock bindings
# /!\ this disables some of Oh my tmux! bindings described in README.md
# - true
# - false (default)
tmux_conf_preserve_stock_bindings=false
# -- session creation ----------------------------------------------------------
# prompt for session name when creating a new session, possible values are:
# - true
# - false (default)
# - disabled (do not modify new-session bindings)
tmux_conf_new_session_prompt=false
# new session retains current path, possible values are:
# - true
# - false (default)
# - disabled (do not modify new-session bindings)
tmux_conf_new_session_retain_current_path=false
# -- windows & pane creation ---------------------------------------------------
# new window retains current path, possible values are:
# - true
# - false (default)
# - disabled (do not modify new-window bindings)
tmux_conf_new_window_retain_current_path=false
# new window tries to reconnect ssh sessions, possible values are:
# - true
# - false (default)
# - disabled (do not modify new-window bindings)
tmux_conf_new_window_reconnect_ssh=false
# new pane retains current path, possible values are:
# - true (default)
# - false
# - disabled (do not modify split-window bindings)
tmux_conf_new_pane_retain_current_path=true
# new pane tries to reconnect ssh sessions, possible values are:
# - true
# - false (default)
# - disabled (do not modify split-window bindings)
tmux_conf_new_pane_reconnect_ssh=false
# -- display -------------------------------------------------------------------
# RGB 24-bit colour support, possible values are:
# - true
# - false
# - auto (default)
#
# automatic detection relies on the COLORTERM environment variable being defined
# to 'truecolor' or '24bit' or '$ tput colors' answering '16777216'
# see https://github.com/termstandard/colors
tmux_conf_24b_colour=auto
# -- theming -------------------------------------------------------------------
# enable or disable theming:
# - enabled (default)
# - disabled
# when disabled, all tmux_conf_theme_xxx variables are ignored except:
# - tmux_conf_theme_pairing
# - tmux_conf_theme_prefix
# - tmux_conf_theme_mouse
# - tmux_conf_theme_root
# - tmux_conf_theme_synchronized
tmux_conf_theme=enabled
# default theme
tmux_conf_theme_colour_1="#080808" # dark gray
tmux_conf_theme_colour_2="#303030" # gray
tmux_conf_theme_colour_3="#8a8a8a" # light gray
tmux_conf_theme_colour_4="#00afff" # light blue
tmux_conf_theme_colour_5="#ffff00" # yellow
tmux_conf_theme_colour_6="#080808" # dark gray
tmux_conf_theme_colour_7="#e4e4e4" # white
tmux_conf_theme_colour_8="#080808" # dark gray
tmux_conf_theme_colour_9="#ffff00" # yellow
tmux_conf_theme_colour_10="#ff00af" # pink
tmux_conf_theme_colour_11="#5fff00" # green
tmux_conf_theme_colour_12="#8a8a8a" # light gray
tmux_conf_theme_colour_13="#e4e4e4" # white
tmux_conf_theme_colour_14="#080808" # dark gray
tmux_conf_theme_colour_15="#080808" # dark gray
tmux_conf_theme_colour_16="#d70000" # red
tmux_conf_theme_colour_17="#e4e4e4" # white
# default theme (ansi)
#tmux_conf_theme_colour_1="colour0"
#tmux_conf_theme_colour_2="colour8"
#tmux_conf_theme_colour_3="colour8"
#tmux_conf_theme_colour_4="colour14"
#tmux_conf_theme_colour_5="colour11"
#tmux_conf_theme_colour_6="colour0"
#tmux_conf_theme_colour_7="colour15"
#tmux_conf_theme_colour_8="colour0"
#tmux_conf_theme_colour_9="colour11"
#tmux_conf_theme_colour_10="colour13"
#tmux_conf_theme_colour_11="colour10"
#tmux_conf_theme_colour_12="colour8"
#tmux_conf_theme_colour_13="colour15"
#tmux_conf_theme_colour_14="colour0"
#tmux_conf_theme_colour_15="colour0"
#tmux_conf_theme_colour_16="colour1"
#tmux_conf_theme_colour_17="colour15"
# window style
tmux_conf_theme_window_fg="default"
tmux_conf_theme_window_bg="default"
# highlight focused pane, possible values are:
# - true
# - false (default)
tmux_conf_theme_highlight_focused_pane=false
# focused pane colours:
tmux_conf_theme_focused_pane_bg="$tmux_conf_theme_colour_2"
# pane border style, possible values are:
# - thin (default)
# - fat
tmux_conf_theme_pane_border_style=thin
# pane borders colours:
tmux_conf_theme_pane_border="$tmux_conf_theme_colour_2"
tmux_conf_theme_pane_active_border="$tmux_conf_theme_colour_4"
%if #{>=:#{version},3.2}
tmux_conf_theme_pane_active_border="#{?pane_in_mode,$tmux_conf_theme_colour_9,#{?synchronize-panes,$tmux_conf_theme_colour_16,$tmux_conf_theme_colour_4}}"
%endif
# pane indicator colours (when you hit <prefix> + q)
tmux_conf_theme_pane_indicator="$tmux_conf_theme_colour_4"
tmux_conf_theme_pane_active_indicator="$tmux_conf_theme_colour_4"
# status line style
tmux_conf_theme_message_fg="$tmux_conf_theme_colour_1"
tmux_conf_theme_message_bg="$tmux_conf_theme_colour_5"
tmux_conf_theme_message_attr="bold"
# status line command style (<prefix> : Escape)
tmux_conf_theme_message_command_fg="$tmux_conf_theme_colour_5"
tmux_conf_theme_message_command_bg="$tmux_conf_theme_colour_1"
tmux_conf_theme_message_command_attr="bold"
# window modes style
tmux_conf_theme_mode_fg="$tmux_conf_theme_colour_1"
tmux_conf_theme_mode_bg="$tmux_conf_theme_colour_5"
tmux_conf_theme_mode_attr="bold"
# status line style
tmux_conf_theme_status_fg="$tmux_conf_theme_colour_3"
tmux_conf_theme_status_bg="$tmux_conf_theme_colour_1"
tmux_conf_theme_status_attr="none"
# terminal title
# - built-in variables are:
# - #{circled_window_index}
# - #{circled_session_name}
# - #{hostname}
# - #{hostname_ssh}
# - #{hostname_full}
# - #{hostname_full_ssh}
# - #{username}
# - #{username_ssh}
tmux_conf_theme_terminal_title="#h ❐ #S ● #I #W"
# window status style
# - built-in variables are:
# - #{circled_window_index}
# - #{circled_session_name}
# - #{hostname}
# - #{hostname_ssh}
# - #{hostname_full}
# - #{hostname_full_ssh}
# - #{username}
# - #{username_ssh}
tmux_conf_theme_window_status_fg="$tmux_conf_theme_colour_3"
tmux_conf_theme_window_status_bg="$tmux_conf_theme_colour_1"
tmux_conf_theme_window_status_attr="none"
tmux_conf_theme_window_status_format="#I #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}"
#tmux_conf_theme_window_status_format="#{circled_window_index} #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}"
#tmux_conf_theme_window_status_format="#I #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}"
# window current status style
# - built-in variables are:
# - #{circled_window_index}
# - #{circled_session_name}
# - #{hostname}
# - #{hostname_ssh}
# - #{hostname_full}
# - #{hostname_full_ssh}
# - #{username}
# - #{username_ssh}
tmux_conf_theme_window_status_current_fg="$tmux_conf_theme_colour_1"
tmux_conf_theme_window_status_current_bg="$tmux_conf_theme_colour_4"
tmux_conf_theme_window_status_current_attr="bold"
tmux_conf_theme_window_status_current_format="#I #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}"
#tmux_conf_theme_window_status_current_format="#{circled_window_index} #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}"
#tmux_conf_theme_window_status_current_format="#I #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}"
# window activity status style
tmux_conf_theme_window_status_activity_fg="default"
tmux_conf_theme_window_status_activity_bg="default"
tmux_conf_theme_window_status_activity_attr="underscore"
# window bell status style
tmux_conf_theme_window_status_bell_fg="$tmux_conf_theme_colour_5"
tmux_conf_theme_window_status_bell_bg="default"
tmux_conf_theme_window_status_bell_attr="blink,bold"
# window last status style
tmux_conf_theme_window_status_last_fg="$tmux_conf_theme_colour_4"
tmux_conf_theme_window_status_last_bg="$tmux_conf_theme_colour_2"
tmux_conf_theme_window_status_last_attr="none"
# status left/right sections separators
#tmux_conf_theme_left_separator_main=""
#tmux_conf_theme_left_separator_sub="|"
#tmux_conf_theme_right_separator_main=""
#tmux_conf_theme_right_separator_sub="|"
tmux_conf_theme_left_separator_main='\uE0B0' # /!\ you don't need to install Powerline
tmux_conf_theme_left_separator_sub='\uE0B1' # you only need fonts patched with
tmux_conf_theme_right_separator_main='\uE0B2' # Powerline symbols or the standalone
tmux_conf_theme_right_separator_sub='\uE0B3' # PowerlineSymbols.otf font, see README.md
# status left/right content:
# - separate main sections with "|"
# - separate subsections with ","
# - built-in variables are:
# - #{battery_bar}
# - #{battery_hbar}
# - #{battery_percentage}
# - #{battery_status}
# - #{battery_vbar}
# - #{circled_session_name}
# - #{hostname_ssh}
# - #{hostname}
# - #{hostname_full}
# - #{hostname_full_ssh}
# - #{loadavg}
# - #{mouse}
# - #{pairing}
# - #{prefix}
# - #{root}
# - #{synchronized}
# - #{uptime_y}
# - #{uptime_d} (modulo 365 when #{uptime_y} is used)
# - #{uptime_h}
# - #{uptime_m}
# - #{uptime_s}
# - #{username}
# - #{username_ssh}
tmux_conf_theme_status_left=" ❐ #S | ↑#{?uptime_y, #{uptime_y}y,}#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} "
#tmux_conf_theme_status_left=" ❐ #S | ↑#{?uptime_y, #{uptime_y}y,}#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} | #{pretty_pane_current_path} "
tmux_conf_theme_status_right=" #{prefix}#{mouse}#{pairing}#{synchronized}#{?battery_status,#{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} | #{hostname} "
# status left style
tmux_conf_theme_status_left_fg="$tmux_conf_theme_colour_6,$tmux_conf_theme_colour_7,$tmux_conf_theme_colour_8"
tmux_conf_theme_status_left_bg="$tmux_conf_theme_colour_9,$tmux_conf_theme_colour_10,$tmux_conf_theme_colour_11"
tmux_conf_theme_status_left_attr="bold,none,none"
# status right style
tmux_conf_theme_status_right_fg="$tmux_conf_theme_colour_12,$tmux_conf_theme_colour_13,$tmux_conf_theme_colour_14"
tmux_conf_theme_status_right_bg="$tmux_conf_theme_colour_15,$tmux_conf_theme_colour_16,$tmux_conf_theme_colour_17"
tmux_conf_theme_status_right_attr="none,none,bold"
# pairing indicator
tmux_conf_theme_pairing="⚇" # U+2687
tmux_conf_theme_pairing_fg="none"
tmux_conf_theme_pairing_bg="none"
tmux_conf_theme_pairing_attr="none"
# prefix indicator
tmux_conf_theme_prefix="⌨" # U+2328
tmux_conf_theme_prefix_fg="none"
tmux_conf_theme_prefix_bg="none"
tmux_conf_theme_prefix_attr="none"
# mouse indicator
tmux_conf_theme_mouse="↗" # U+2197
tmux_conf_theme_mouse_fg="none"
tmux_conf_theme_mouse_bg="none"
tmux_conf_theme_mouse_attr="none"
# root indicator
tmux_conf_theme_root="!"
tmux_conf_theme_root_fg="none"
tmux_conf_theme_root_bg="none"
tmux_conf_theme_root_attr="bold,blink"
# synchronized indicator
tmux_conf_theme_synchronized="⚏" # U+268F
tmux_conf_theme_synchronized_fg="none"
tmux_conf_theme_synchronized_bg="none"
tmux_conf_theme_synchronized_attr="none"
# battery bar symbols
tmux_conf_battery_bar_symbol_full="◼"
tmux_conf_battery_bar_symbol_empty="◻"
#tmux_conf_battery_bar_symbol_full="♥"
#tmux_conf_battery_bar_symbol_empty="·"
# battery bar length (in number of symbols), possible values are:
# - auto
# - a number, e.g. 5
tmux_conf_battery_bar_length="auto"
# battery bar palette, possible values are:
# - gradient (default)
# - heat
# - "colour_full_fg,colour_empty_fg,colour_bg"
# - gradient(colour_fg_1,colour_fg_2,...,colour_fg_n)
tmux_conf_battery_bar_palette="gradient"
#tmux_conf_battery_bar_palette="#d70000,#e4e4e4,#000000" # red, white, black
#tmux_conf_battery_bar_palette="gradient(#00afff,#47a2ff,#7c91ff,#ac7afb,#d65be2,#e163df,#eb6cdd,#f475db,#ec9ff1,#eac3fe,#efe2ff,#ffffff)"
# battery hbar palette, possible values are:
# - gradient (default)
# - heat
# - "colour_low,colour_half,colour_full"
# - gradient(colour_fg_1,colour_fg_2,...,colour_fg_n)
tmux_conf_battery_hbar_palette="gradient"
#tmux_conf_battery_hbar_palette="#d70000,#ff5f00,#5fff00" # red, orange, green
#tmux_conf_battery_hbar_palette="gradient(#00afff,#47a2ff,#7c91ff,#ac7afb,#d65be2,#e163df,#eb6cdd,#f475db,#ec9ff1,#eac3fe,#efe2ff,#ffffff)"
# battery vbar palette, possible values are:
# - gradient (default)
# - heat
# - "colour_low,colour_half,colour_full"
# - gradient(colour_fg_1,colour_fg_2,...,colour_fg_n)
tmux_conf_battery_vbar_palette="gradient"
#tmux_conf_battery_vbar_palette="#d70000,#ff5f00,#5fff00" # red, orange, green
#tmux_conf_battery_vbar_palette="gradient(#00afff,#47a2ff,#7c91ff,#ac7afb,#d65be2,#e163df,#eb6cdd,#f475db,#ec9ff1,#eac3fe,#efe2ff,#ffffff)"
# symbols used to indicate whether battery is charging or discharging
tmux_conf_battery_status_charging="↑" # U+2191
tmux_conf_battery_status_discharging="↓" # U+2193
#tmux_conf_battery_status_charging="🔌" # U+1F50C
#tmux_conf_battery_status_discharging="🔋" # U+1F50B
# clock style (when you hit <prefix> + t)
# you may want to use %I:%M %p in place of %R in tmux_conf_theme_status_right
tmux_conf_theme_clock_colour="$tmux_conf_theme_colour_4"
tmux_conf_theme_clock_style="24"
# -- clipboard -----------------------------------------------------------------
# in copy mode, copying selection also copies to the OS clipboard
# - true
# - false (default)
# - disabled
# on Linux, this requires xsel, xclip or wl-copy
tmux_conf_copy_to_os_clipboard=false
# -- urlscan -------------------------------------------------------------------
# options passed to urlscan
tmux_conf_urlscan_options="--compact --dedupe"
# -- user customizations -------------------------------------------------------
# this is the place to override or undo settings
# increase history size
#set -g history-limit 10000
# start with mouse mode enabled
set -g mouse on
# force Vi mode
# really you should export VISUAL or EDITOR environment variable, see manual
#set -g status-keys vi
#set -g mode-keys vi
# replace C-b by C-a instead of using both prefixes
# set -gu prefix2
# unbind C-a
# unbind C-b
# set -g prefix C-a
# bind C-a send-prefix
# if you don't want Oh my tmux! to alter a binding or a setting, use #!important
# bind c new-window -c '#{pane_current_path}' #!important
# display a message after toggling mouse support
bind m run "cut -c3- '#{TMUX_CONF}' | sh -s _toggle_mouse" \; display 'mouse #{?#{mouse},on,off}'
# cycle through windows/tabs with Shift+Left/Right keys (no prefix needed)
bind -n S-Left previous-window
bind -n S-Right next-window
# cycle through sessions/workspaces with Shift+Up/Down keys (no prefix needed)
bind -n S-Up switch-client -p
bind -n S-Down switch-client -n
# move status line to top
#set -g status-position top
# cleaner pane borders (VS Code-like)
set -g pane-border-lines single
set -g pane-border-style fg=brightblack
set -g pane-active-border-style fg=blue
# -- tpm -----------------------------------------------------------------------
# while I don't use tpm myself, many people requested official support so here
# is a seamless integration that automatically installs plugins in parallel
# whenever a plugin introduces a variable to be used in 'status-left' or
# 'status-right', you can use it in 'tmux_conf_theme_status_left' and
# 'tmux_conf_theme_status_right' variables.
# by default, launching tmux will update tpm and all plugins
# - true (default)
# - false
tmux_conf_update_plugins_on_launch=true
# by default, reloading the configuration will update tpm and all plugins
# - true (default)
# - false
tmux_conf_update_plugins_on_reload=true
# by default, reloading the configuration will uninstall tpm and plugins when no
# plugins are enabled
# - true (default)
# - false
tmux_conf_uninstall_plugins_on_reload=true
# /!\ the tpm bindings differ slightly from upstream:
# - installing plugins: <prefix> + I
# - uninstalling plugins: <prefix> + Alt + u
# - updating plugins: <prefix> + u
# /!\ do not add set -g @plugin 'tmux-plugins/tpm'
# /!\ do not add run '~/.tmux/plugins/tpm/tpm'
# to enable a plugin, use the 'set -g @plugin' syntax:
# visit https://github.com/tmux-plugins for available plugins
#set -g @plugin 'tmux-plugins/tmux-copycat'
#set -g @plugin 'tmux-plugins/tmux-cpu'
#set -g @plugin 'tmux-plugins/tmux-resurrect'
#set -g @plugin 'tmux-plugins/tmux-continuum'
#set -g @continuum-restore 'on'
# -- custom variables ----------------------------------------------------------
# to define a custom #{foo} variable, define a POSIX shell function between the
# '# EOF' and the '# "$@"' lines. Please note that the opening brace { character
# must be on the same line as the function name otherwise the parse won't detect
# it.
#
# then, use #{foo} in e.g. the 'tmux_conf_theme_status_left' or the
# 'tmux_conf_theme_status_right' variables.
# ------------------------------------------------------------------------------
# # /!\ do not remove the following line
# EOF
#
# # /!\ do not "uncomment" the functions: the leading "# " characters are needed
#
# # usage: #{weather}
# weather() { # see https://github.com/chubin/wttr.in#one-line-output
# curl -f -s -m 2 'wttr.in?format=3' || printf '\n' # /!\ make sure curl is installed
# sleep 900 # sleep for 15 minutes, throttle network requests whatever the value of status-interval
# }
#
# # usage: #{online}
# online() {
# ping -c 1 1.1.1.1 >/dev/null 2>&1 && printf '✔' || printf '✘'
# }
#
# # usage: #{wan_ip_v4}
# wan_ip_v4() {
# curl -f -s -m 2 -4 ifconfig.me
# sleep 300 # sleep for 5 minutes, throttle network requests whatever the value of status-interval
# }
#
# # usage: #{wan_ip_v6}
# wan_ip_v6() {
# curl -f -s -m 2 -6 ifconfig.me
# sleep 300 # sleep for 5 minutes, throttle network requests whatever the value of status-interval
# }
#
# # usage: #{github_stars}, #{github_stars tmux/tmux}, ...
# github_stars() {
# repository=${1##*https://github.com/}
# repository=${repository%% *}
# repository=${repository%%.git}
# url="https://api.github.com/repos/${repository:-gpakosz/.tmux}"
# curl -s "$url" | perl -MJSON::PP=decode_json -CO -0777 -E '$response = decode_json(readline *STDIN); say ($response->{stargazers_count})'
# sleep 300 # sleep for 5 minutes, throttle network requests whatever the value of status-interval
# }
#
# "$@"
# # /!\ do not remove the previous line
# # do not write below this line
-505
View File
@@ -1,505 +0,0 @@
{{- if eq .chezmoi.os "darwin" -}}
#? Config file for btop v. 1.4.5
#* Name of a btop++/bpytop/bashtop formatted ".theme" file, "Default" and "TTY" for builtin themes.
#* Themes should be placed in "../share/btop/themes" relative to binary or "$HOME/.config/btop/themes"
color_theme = "TTY"
#* If the theme set background should be shown, set to False if you want terminal background transparency.
theme_background = True
#* Sets if 24-bit truecolor should be used, will convert 24-bit colors to 256 color (6x6x6 color cube) if false.
truecolor = True
#* Set to true to force tty mode regardless if a real tty has been detected or not.
#* Will force 16-color mode and TTY theme, set all graph symbols to "tty" and swap out other non tty friendly symbols.
force_tty = False
#* Define presets for the layout of the boxes. Preset 0 is always all boxes shown with default settings. Max 9 presets.
#* Format: "box_name:P:G,box_name:P:G" P=(0 or 1) for alternate positions, G=graph symbol to use for box.
#* Use whitespace " " as separator between different presets.
#* Example: "cpu:0:default,mem:0:tty,proc:1:default cpu:0:braille,proc:0:tty"
presets = "cpu:1:default,proc:0:default cpu:0:default,mem:0:default,net:0:default cpu:0:block,net:0:tty"
#* Set to True to enable "h,j,k,l,g,G" keys for directional control in lists.
#* Conflicting keys for h:"help" and k:"kill" is accessible while holding shift.
vim_keys = False
#* Rounded corners on boxes, is ignored if TTY mode is ON.
rounded_corners = True
#* Default symbols to use for graph creation, "braille", "block" or "tty".
#* "braille" offers the highest resolution but might not be included in all fonts.
#* "block" has half the resolution of braille but uses more common characters.
#* "tty" uses only 3 different symbols but will work with most fonts and should work in a real TTY.
#* Note that "tty" only has half the horizontal resolution of the other two, so will show a shorter historical view.
graph_symbol = "braille"
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
graph_symbol_cpu = "default"
# Graph symbol to use for graphs in gpu box, "default", "braille", "block" or "tty".
graph_symbol_gpu = "default"
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
graph_symbol_mem = "default"
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
graph_symbol_net = "default"
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
graph_symbol_proc = "default"
#* Manually set which boxes to show. Available values are "cpu mem net proc" and "gpu0" through "gpu5", separate values with whitespace.
shown_boxes = "cpu mem net proc"
#* Update time in milliseconds, recommended 2000 ms or above for better sample times for graphs.
update_ms = 2000
#* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct",
#* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly.
proc_sorting = "cpu lazy"
#* Reverse sorting order, True or False.
proc_reversed = False
#* Show processes as a tree.
proc_tree = False
#* Use the cpu graph colors in the process list.
proc_colors = True
#* Use a darkening gradient in the process list.
proc_gradient = True
#* If process cpu usage should be of the core it's running on or usage of the total available cpu power.
proc_per_core = True
#* Show process memory as bytes instead of percent.
proc_mem_bytes = True
#* Show cpu graph for each process.
proc_cpu_graphs = True
#* Use /proc/[pid]/smaps for memory information in the process info box (very slow but more accurate)
proc_info_smaps = False
#* Show proc box on left side of screen instead of right.
proc_left = False
#* (Linux) Filter processes tied to the Linux kernel(similar behavior to htop).
proc_filter_kernel = False
#* In tree-view, always accumulate child process resources in the parent process.
proc_aggregate = False
#* Sets the CPU stat shown in upper half of the CPU graph, "total" is always available.
#* Select from a list of detected attributes from the options menu.
cpu_graph_upper = "Auto"
#* Sets the CPU stat shown in lower half of the CPU graph, "total" is always available.
#* Select from a list of detected attributes from the options menu.
cpu_graph_lower = "iowait"
#* If gpu info should be shown in the cpu box. Available values = "Auto", "On" and "Off".
show_gpu_info = "Auto"
#* Toggles if the lower CPU graph should be inverted.
cpu_invert_lower = True
#* Set to True to completely disable the lower CPU graph.
cpu_single_graph = False
#* Show cpu box at bottom of screen instead of top.
cpu_bottom = False
#* Shows the system uptime in the CPU box.
show_uptime = True
#* Shows the CPU package current power consumption in watts. Requires running `make setcap` or `make setuid` or running with sudo.
show_cpu_watts = True
#* Show cpu temperature.
check_temp = True
#* Which sensor to use for cpu temperature, use options menu to select from list of available sensors.
cpu_sensor = "Auto"
#* Show temperatures for cpu cores also if check_temp is True and sensors has been found.
show_coretemp = True
#* Set a custom mapping between core and coretemp, can be needed on certain cpus to get correct temperature for correct core.
#* Use lm-sensors or similar to see which cores are reporting temperatures on your machine.
#* Format "x:y" x=core with wrong temp, y=core with correct temp, use space as separator between multiple entries.
#* Example: "4:0 5:1 6:3"
cpu_core_map = ""
#* Which temperature scale to use, available values: "celsius", "fahrenheit", "kelvin" and "rankine".
temp_scale = "celsius"
#* Use base 10 for bits/bytes sizes, KB = 1000 instead of KiB = 1024.
base_10_sizes = False
#* Show CPU frequency.
show_cpu_freq = True
#* Draw a clock at top of screen, formatting according to strftime, empty string to disable.
#* Special formatting: /host = hostname | /user = username | /uptime = system uptime
clock_format = "%X"
#* Update main ui in background when menus are showing, set this to false if the menus is flickering too much for comfort.
background_update = True
#* Custom cpu model name, empty string to disable.
custom_cpu_name = ""
#* Optional filter for shown disks, should be full path of a mountpoint, separate multiple values with whitespace " ".
#* Only disks matching the filter will be shown. Prepend exclude= to only show disks not matching the filter. Examples: disk_filter="/boot /home/user", disks_filter="exclude=/boot /home/user"
disks_filter = ""
#* Show graphs instead of meters for memory values.
mem_graphs = True
#* Show mem box below net box instead of above.
mem_below_net = False
#* Count ZFS ARC in cached and available memory.
zfs_arc_cached = True
#* If swap memory should be shown in memory box.
show_swap = True
#* Show swap as a disk, ignores show_swap value above, inserts itself after first disk.
swap_disk = True
#* If mem box should be split to also show disks info.
show_disks = True
#* Filter out non physical disks. Set this to False to include network disks, RAM disks and similar.
only_physical = False
#* Read disks list from /etc/fstab. This also disables only_physical.
use_fstab = True
#* Setting this to True will hide all datasets, and only show ZFS pools. (IO stats will be calculated per-pool)
zfs_hide_datasets = False
#* Set to true to show available disk space for privileged users.
disk_free_priv = True
#* Toggles if io activity % (disk busy time) should be shown in regular disk usage view.
show_io_stat = True
#* Toggles io mode for disks, showing big graphs for disk read/write speeds.
io_mode = False
#* Set to True to show combined read/write io graphs in io mode.
io_graph_combined = False
#* Set the top speed for the io graphs in MiB/s (100 by default), use format "mountpoint:speed" separate disks with whitespace " ".
#* Example: "/mnt/media:100 /:20 /boot:1".
io_graph_speeds = ""
#* Set fixed values for network graphs in Mebibits. Is only used if net_auto is also set to False.
net_download = 100
net_upload = 100
#* Use network graphs auto rescaling mode, ignores any values set above and rescales down to 10 Kibibytes at the lowest.
net_auto = True
#* Sync the auto scaling for download and upload to whichever currently has the highest scale.
net_sync = True
#* Starts with the Network Interface specified here.
net_iface = ""
#* "True" shows bitrates in base 10 (Kbps, Mbps). "False" shows bitrates in binary sizes (Kibps, Mibps, etc.). "Auto" uses base_10_sizes.
base_10_bitrate = "Auto"
#* Show battery stats in top right if battery is present.
show_battery = True
#* Which battery to use if multiple are present. "Auto" for auto detection.
selected_battery = "Auto"
#* Show power stats of battery next to charge indicator.
show_battery_watts = True
#* Set loglevel for "~/.config/btop/btop.log" levels are: "ERROR" "WARNING" "INFO" "DEBUG".
#* The level set includes all lower levels, i.e. "DEBUG" will show all logging info.
log_level = "WARNING"
#* Measure PCIe throughput on NVIDIA cards, may impact performance on certain cards.
nvml_measure_pcie_speeds = True
#* Measure PCIe throughput on AMD cards, may impact performance on certain cards.
rsmi_measure_pcie_speeds = True
#* Horizontally mirror the GPU graph.
gpu_mirror_graph = True
#* Custom gpu0 model name, empty string to disable.
custom_gpu_name0 = ""
#* Custom gpu1 model name, empty string to disable.
custom_gpu_name1 = ""
#* Custom gpu2 model name, empty string to disable.
custom_gpu_name2 = ""
#* Custom gpu3 model name, empty string to disable.
custom_gpu_name3 = ""
#* Custom gpu4 model name, empty string to disable.
custom_gpu_name4 = ""
#* Custom gpu5 model name, empty string to disable.
custom_gpu_name5 = ""
{{- else if eq .chezmoi.os "linux" -}}
#? Config file for btop v. 1.3.0
#* Name of a btop++/bpytop/bashtop formatted ".theme" file, "Default" and "TTY" for builtin themes.
#* Themes should be placed in "../share/btop/themes" relative to binary or "$HOME/.config/btop/themes"
color_theme = "TTY"
#* If the theme set background should be shown, set to False if you want terminal background transparency.
theme_background = True
#* Sets if 24-bit truecolor should be used, will convert 24-bit colors to 256 color (6x6x6 color cube) if false.
truecolor = True
#* Set to true to force tty mode regardless if a real tty has been detected or not.
#* Will force 16-color mode and TTY theme, set all graph symbols to "tty" and swap out other non tty friendly symbols.
force_tty = False
#* Define presets for the layout of the boxes. Preset 0 is always all boxes shown with default settings. Max 9 presets.
#* Format: "box_name:P:G,box_name:P:G" P=(0 or 1) for alternate positions, G=graph symbol to use for box.
#* Use whitespace " " as separator between different presets.
#* Example: "cpu:0:default,mem:0:tty,proc:1:default cpu:0:braille,proc:0:tty"
presets = "cpu:1:default,proc:0:default cpu:0:default,mem:0:default,net:0:default cpu:0:block,net:0:tty"
#* Set to True to enable "h,j,k,l,g,G" keys for directional control in lists.
#* Conflicting keys for h:"help" and k:"kill" is accessible while holding shift.
vim_keys = False
#* Rounded corners on boxes, is ignored if TTY mode is ON.
rounded_corners = True
#* Default symbols to use for graph creation, "braille", "block" or "tty".
#* "braille" offers the highest resolution but might not be included in all fonts.
#* "block" has half the resolution of braille but uses more common characters.
#* "tty" uses only 3 different symbols but will work with most fonts and should work in a real TTY.
#* Note that "tty" only has half the horizontal resolution of the other two, so will show a shorter historical view.
graph_symbol = "braille"
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
graph_symbol_cpu = "default"
# Graph symbol to use for graphs in gpu box, "default", "braille", "block" or "tty".
graph_symbol_gpu = "default"
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
graph_symbol_mem = "default"
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
graph_symbol_net = "default"
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
graph_symbol_proc = "default"
#* Manually set which boxes to show. Available values are "cpu mem net proc" and "gpu0" through "gpu5", separate values with whitespace.
shown_boxes = "cpu mem net proc"
#* Update time in milliseconds, recommended 2000 ms or above for better sample times for graphs.
update_ms = 2000
#* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct",
#* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly.
proc_sorting = "cpu direct"
#* Reverse sorting order, True or False.
proc_reversed = False
#* Show processes as a tree.
proc_tree = False
#* Use the cpu graph colors in the process list.
proc_colors = True
#* Use a darkening gradient in the process list.
proc_gradient = True
#* If process cpu usage should be of the core it's running on or usage of the total available cpu power.
proc_per_core = True
#* Show process memory as bytes instead of percent.
proc_mem_bytes = True
#* Show cpu graph for each process.
proc_cpu_graphs = True
#* Use /proc/[pid]/smaps for memory information in the process info box (very slow but more accurate)
proc_info_smaps = False
#* Show proc box on left side of screen instead of right.
proc_left = False
#* (Linux) Filter processes tied to the Linux kernel(similar behavior to htop).
proc_filter_kernel = False
#* In tree-view, always accumulate child process resources in the parent process.
proc_aggregate = False
#* Sets the CPU stat shown in upper half of the CPU graph, "total" is always available.
#* Select from a list of detected attributes from the options menu.
cpu_graph_upper = "Auto"
#* Sets the CPU stat shown in lower half of the CPU graph, "total" is always available.
#* Select from a list of detected attributes from the options menu.
cpu_graph_lower = "iowait"
#* If gpu info should be shown in the cpu box. Available values = "Auto", "On" and "Off".
show_gpu_info = "Auto"
#* Toggles if the lower CPU graph should be inverted.
cpu_invert_lower = True
#* Set to True to completely disable the lower CPU graph.
cpu_single_graph = False
#* Show cpu box at bottom of screen instead of top.
cpu_bottom = False
#* Shows the system uptime in the CPU box.
show_uptime = True
#* Show cpu temperature.
check_temp = True
#* Which sensor to use for cpu temperature, use options menu to select from list of available sensors.
cpu_sensor = "Auto"
#* Show temperatures for cpu cores also if check_temp is True and sensors has been found.
show_coretemp = True
#* Set a custom mapping between core and coretemp, can be needed on certain cpus to get correct temperature for correct core.
#* Use lm-sensors or similar to see which cores are reporting temperatures on your machine.
#* Format "x:y" x=core with wrong temp, y=core with correct temp, use space as separator between multiple entries.
#* Example: "4:0 5:1 6:3"
cpu_core_map = ""
#* Which temperature scale to use, available values: "celsius", "fahrenheit", "kelvin" and "rankine".
temp_scale = "celsius"
#* Use base 10 for bits/bytes sizes, KB = 1000 instead of KiB = 1024.
base_10_sizes = False
#* Show CPU frequency.
show_cpu_freq = True
#* Draw a clock at top of screen, formatting according to strftime, empty string to disable.
#* Special formatting: /host = hostname | /user = username | /uptime = system uptime
clock_format = "%X"
#* Update main ui in background when menus are showing, set this to false if the menus is flickering too much for comfort.
background_update = True
#* Custom cpu model name, empty string to disable.
custom_cpu_name = ""
#* Optional filter for shown disks, should be full path of a mountpoint, separate multiple values with whitespace " ".
#* Begin line with "exclude=" to change to exclude filter, otherwise defaults to "most include" filter. Example: disks_filter="exclude=/boot /home/user".
disks_filter = ""
#* Show graphs instead of meters for memory values.
mem_graphs = True
#* Show mem box below net box instead of above.
mem_below_net = False
#* Count ZFS ARC in cached and available memory.
zfs_arc_cached = True
#* If swap memory should be shown in memory box.
show_swap = True
#* Show swap as a disk, ignores show_swap value above, inserts itself after first disk.
swap_disk = True
#* If mem box should be split to also show disks info.
show_disks = True
#* Filter out non physical disks. Set this to False to include network disks, RAM disks and similar.
only_physical = False
#* Read disks list from /etc/fstab. This also disables only_physical.
use_fstab = True
#* Setting this to True will hide all datasets, and only show ZFS pools. (IO stats will be calculated per-pool)
zfs_hide_datasets = False
#* Set to true to show available disk space for privileged users.
disk_free_priv = True
#* Toggles if io activity % (disk busy time) should be shown in regular disk usage view.
show_io_stat = True
#* Toggles io mode for disks, showing big graphs for disk read/write speeds.
io_mode = False
#* Set to True to show combined read/write io graphs in io mode.
io_graph_combined = False
#* Set the top speed for the io graphs in MiB/s (100 by default), use format "mountpoint:speed" separate disks with whitespace " ".
#* Example: "/mnt/media:100 /:20 /boot:1".
io_graph_speeds = ""
#* Set fixed values for network graphs in Mebibits. Is only used if net_auto is also set to False.
net_download = 100
net_upload = 100
#* Use network graphs auto rescaling mode, ignores any values set above and rescales down to 10 Kibibytes at the lowest.
net_auto = False
#* Sync the auto scaling for download and upload to whichever currently has the highest scale.
net_sync = True
#* Starts with the Network Interface specified here.
net_iface = ""
#* Show battery stats in top right if battery is present.
show_battery = True
#* Which battery to use if multiple are present. "Auto" for auto detection.
selected_battery = "Auto"
#* Set loglevel for "~/.config/btop/btop.log" levels are: "ERROR" "WARNING" "INFO" "DEBUG".
#* The level set includes all lower levels, i.e. "DEBUG" will show all logging info.
log_level = "WARNING"
#* Measure PCIe throughput on NVIDIA cards, may impact performance on certain cards.
nvml_measure_pcie_speeds = True
#* Horizontally mirror the GPU graph.
gpu_mirror_graph = True
#* Custom gpu0 model name, empty string to disable.
custom_gpu_name0 = ""
#* Custom gpu1 model name, empty string to disable.
custom_gpu_name1 = ""
#* Custom gpu2 model name, empty string to disable.
custom_gpu_name2 = ""
#* Custom gpu3 model name, empty string to disable.
custom_gpu_name3 = ""
#* Custom gpu4 model name, empty string to disable.
custom_gpu_name4 = ""
#* Custom gpu5 model name, empty string to disable.
custom_gpu_name5 = ""
{{- end }}
Loaded 100 of 148 files, more files were not shown because too many files have changed in this diff. Show more