From 04896c78095dc0f568ca758f789178fc909302e5 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Tue, 21 Apr 2026 01:23:27 +0100 Subject: feat: split drift recipes and add 'just undeclared' - 'just status' now a thin wrapper for 'pkg-drift + dotfile-drift' - 'just pkg-drift' and 'just dotfile-drift' are individually addressable - 'just undeclared' prints undeclared packages unindented, one per line, so they pipe cleanly into 'paru -Rs -' - pkg-drift reuses 'just undeclared' via sed to avoid duplicating logic --- justfile | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'justfile') diff --git a/justfile b/justfile index fabe4f0..fb6b10b 100644 --- a/justfile +++ b/justfile @@ -44,8 +44,11 @@ fix: # Inspection # ═══════════════════════════════════════════════════════════════════ -# Show package and dotfile drift (only for groups ≥50% installed) -status: +# Show package and dotfile drift (runs pkg-drift + dotfile-drift) +status: pkg-drift dotfile-drift + +# Show package drift: missing packages in adopted groups + undeclared installed packages +pkg-drift: #!/bin/sh active_file=$(mktemp) trap 'rm -f "$active_file"' EXIT @@ -61,19 +64,28 @@ status: fi done active=$(sort -u "$active_file") - declared=$(cat meta/*.txt | grep -v '^\s*#' | grep -v '^\s*$' | sort -u) echo "=== Package drift ===" echo "$active" | while read -r pkg; do [ -z "$pkg" ] && continue pacman -Qi "$pkg" >/dev/null 2>&1 || echo " missing: $pkg" done - pacman -Qqe | while read -r pkg; do - echo "$declared" | grep -qxF "$pkg" || echo " undeclared: $pkg" - done - echo "" + just undeclared | sed 's/^/ undeclared: /' + +# Show dotfile drift (wraps 'chezmoi status') +dotfile-drift: + #!/bin/sh echo "=== Dotfile drift ===" chezmoi status -S . || true +# Print undeclared packages (installed but not in any meta/*.txt), one per line, unindented +# Pipeable: just undeclared | paru -Rs - +undeclared: + #!/bin/sh + declared=$(cat meta/*.txt | grep -v '^\s*#' | grep -v '^\s*$' | sort -u) + pacman -Qqe | while read -r pkg; do + echo "$declared" | grep -qxF "$pkg" || echo "$pkg" + done + # Show dotfile diffs; pass a path to limit to a single file (e.g. just diff .config/nvim/init.lua) diff file="": chezmoi diff -S . {{ file }} -- cgit v1.2.3-70-g09d2