Skip to content

feat(fastfetch): add cached update, reboot and ansible-pull status modules - #601

Merged
DevSecNinja merged 1 commit into
mainfrom
feat/fastfetch-status-modules
Jul 27, 2026
Merged

feat(fastfetch): add cached update, reboot and ansible-pull status modules#601
DevSecNinja merged 1 commit into
mainfrom
feat/fastfetch-status-modules

Conversation

@DevSecNinja

Copy link
Copy Markdown
Owner

What

Extends fastfetch with three self-hiding status lines:

  • Updates — count of available package updates
  • Reboot — pending-reboot indicator
  • Ansible — last ansible-pull run status for hosts managed by the DevSecNinja/docker project (OK/FAILED, last-run age, next run, config SHA)

A line only appears when there's something to report (fastfetch hides a command module that prints nothing), so an up-to-date, unmanaged host looks exactly like before.

Files

  • home/dot_config/fastfetch/executable_status.sh~/.config/fastfetch/status.sh
  • home/dot_config/fastfetch/config.jsonc — default layout + the 3 command modules
  • home/.chezmoiignore — skip this bash-driven dir on Windows
  • tests/bash/fastfetch-status.bats — 15 tests

Performance (runs on every shell login)

Section commands only cat a small cache under ~/.cache/fastfetch-status/. When the cache is stale (TTL default 1h) they print the current value instantly and spawn a fully-detached background refresh (stale-while-revalidate). The expensive work needs no root and no network and never runs apt update. Verified: full render stays ~300ms even while a refresh runs in the background.

Update checks cover apt, dnf, pacman, zypper, apk (Linux) and brew (macOS / Linuxbrew). Reboot detection is Linux-only.

Tunables

FASTFETCH_STATUS_TTL, FASTFETCH_STATUS_DISABLE=1, ANSIBLE_PULL_WORKDIR; status.sh refresh --force / clear.

Testing

  • ./tests/bash/run-tests.sh --test fastfetch-status.bats → 15/15 pass
  • shellcheck + shfmt clean; lefthook pre-commit green
  • Rendered against a real host (this dev VM is ansible-managed): the Ansible line correctly showed its last failed pull; Updates/Reboot correctly hidden.

…dules

Adds self-hiding fastfetch modules that surface available package
updates, a pending reboot, and (on hosts managed by DevSecNinja/docker
ansible-pull) the last ansible-pull run status.

status.sh reads a small cache and refreshes it in a fully detached
background process (stale-while-revalidate), so shell login stays fast;
it never needs root or the network. Update checks cover apt, dnf,
pacman, zypper, apk and brew (macOS/Linuxbrew). Empty output makes a
line disappear, so each line only shows when relevant.

Windows keeps its default fastfetch config via .chezmoiignore.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@DevSecNinja
DevSecNinja merged commit fb9d53e into main Jul 27, 2026
16 checks passed
@DevSecNinja
DevSecNinja deleted the feat/fastfetch-status-modules branch July 27, 2026 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant