diff options
| author | 2026-04-21 01:23:27 +0100 | |
|---|---|---|
| committer | 2026-04-21 01:23:27 +0100 | |
| commit | 04896c78095dc0f568ca758f789178fc909302e5 (patch) | |
| tree | 9c44be690107766a4a00e64ab25d477f0e151452 | |
| parent | 7ef0202e2eee0feaeac3041fe2643f4d3b82ce3d (diff) | |
| download | dotfiles-04896c78095dc0f568ca758f789178fc909302e5.tar.gz dotfiles-04896c78095dc0f568ca758f789178fc909302e5.tar.bz2 dotfiles-04896c78095dc0f568ca758f789178fc909302e5.zip | |
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
| -rw-r--r-- | .github/copilot-instructions.md | 2 | ||||
| -rw-r--r-- | 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 @@ -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 }} |
