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 --- .github/copilot-instructions.md | 2 +- justfile | 26 +++++++++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 1123712..fa1c75d 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -19,7 +19,7 @@ The repo root is a chezmoi source directory. Files targeting `$HOME` use chezmoi - `create-efi.sh` is an interactive EFI boot entry creation script using `efibootmgr`. - `.chezmoiignore` excludes non-home files (`etc/`, `meta/`, `firefox/`, docs) from deployment to `$HOME`. - `.githooks/` contains git hooks (notably `post-commit` which runs `chezmoi apply`). Activated by `just init`. -- `justfile` provides recipes: `init` (first-time setup), `sync` (apply + fix), `apply`, `fix`, `status`, `diff`, `merge`, `groups`, `install`, `install-all`, `add`. Run `just` or `just --list` to see them. +- `justfile` provides recipes: `init` (first-time setup), `sync` (apply + fix), `apply`, `fix`, `status`, `pkg-drift`, `dotfile-drift`, `undeclared`, `diff`, `merge`, `groups`, `install`, `install-all`, `add`. Run `just` or `just --list` to see them. ## Window manager 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