Skip to content

fix: installer robustness, CI coverage & shellcheck unification#10

Merged
0xdilshan merged 12 commits into
mainfrom
dev
Feb 24, 2026
Merged

fix: installer robustness, CI coverage & shellcheck unification#10
0xdilshan merged 12 commits into
mainfrom
dev

Conversation

@0xdilshan

@0xdilshan 0xdilshan commented Feb 24, 2026

Copy link
Copy Markdown
Owner

Summary

This PR addresses 16 issues found during a code review of the installer, .zshrc, CI workflow, and test scripts. Changes fall into four areas: installer reliability, .zshrc correctness, CI coverage, and linting consistency.


install.sh

  • set -eset -uo pipefailset -e interacts poorly with subshells and conditional logic. Replaced with pipefail and explicit || { ...; exit 1; } checks on critical commands.
  • Idempotency — Starship install and font install now skip gracefully if already present, matching the existing eza skip pattern. Re-running the installer is now safe.
  • Dynamic font version — Hardcoded v3.4.0 in the FiraCode download URL replaced with a GitHub API lookup. Falls back to v3.4.0 if the API is unreachable.
  • EZA_TMP leak fixed — The Fedora 42+ binary temp dir is now registered in a TEMP_DIRS[] array tracked by the global cleanup trap, so it's always removed on exit or interrupt.
  • chsh failure surfaced — Previously swallowed with > /dev/null 2>&1. Now prints an actionable warning with the manual command if it fails.

.zshrc

  • nocompile comment — Added a comment explaining why nocompile"init.zsh" is used alongside src"init.zsh" on the zoxide ice, which was previously confusing.
  • Idiomatic unaliasunalias zi zpl zplg 2>/dev/null replaced with (( ${+aliases[name]} )) && unalias name for each alias — no stderr suppression needed.
  • zshift-update modification warning — The updater now diffs the current .zshrc against the backup before overwriting. If local edits are detected, it warns the user and prompts for confirmation, pointing them to ~/.zshrc.local for persistent customisation.
  • help() comment — Added a comment noting the intentional override of the Zsh built-in help.

ci.yml

  • theme.sh and uninstall.sh linted — Both were previously untested in CI; a syntax error in either would ship silently.
  • Bootstrap output capturedzsh -ic "exit" || true now pipes output to the log before allowing non-zero exit, so a broken .zshrc is visible rather than silently passing.
  • Real tool verification — Added a post-bootstrap step that checks eza, bat, fzf, zoxide, and starship are actually callable via zsh -ic "command -v ...". Fails if 3+ tools are missing. Same check added to Docker jobs.
  • Shellcheck unified via .shellcheckrc — See below.

.shellcheckrc (new file)

  • Centralises SC2086, SC2034, and SC1091 ignore rules. CI and tests/local_test.sh previously had divergent -e flag lists. Both now pick up .shellcheckrc automatically.

uninstall.sh

  • Fedora 42+ removal order fixed — Previously attempted dnf remove eza (which fails on 42+ since eza was installed manually), logged a confusing error, then succeeded via the catch-all rm. Now branches on FEDORA_VERSION and removes the binary directly without the misleading error.
  • Zinit removal message updated — Clarifies that removing the Zinit directory also removes Zinit-managed binaries (bat, fd, fzf, rg, zoxide, eza).

tests/local_test.sh

  • Path anchoring — Replaced fragile [ -f "../$file" ] || [ -f "$file" ] detection with SCRIPT_DIR / REPO_ROOT derived from $(dirname "$0"). The script now works correctly regardless of the working directory it's called from.
  • Lints all scripts — Now checks install.sh, theme.sh, and uninstall.sh (was only install.sh). No longer passes -e flags since .shellcheckrc handles that.

Testing

  • Verified shellcheck passes locally on all three scripts with .shellcheckrc in place
  • CI jobs updated to reflect new lint and verification steps
  • No changes to external behaviour or user-facing prompts

Checklist

  • All shell scripts pass shellcheck with shared .shellcheckrc
  • zsh -n .zshrc passes
  • Installer is idempotent (safe to re-run)
  • No breaking changes to existing user configs or aliases

Summary by CodeRabbit

  • New Features

    • Added safety check that warns users if .zshrc has changed before applying updates
    • Added zsu alias for quick update access
  • Bug Fixes

    • Enhanced cross-platform installer and uninstaller support (Debian, Arch, Fedora, OpenSUSE, macOS)
    • Improved error handling and root privilege checks
    • Better cleanup of temporary files during installation
  • Chores

    • Expanded CI testing across multiple Linux distributions
    • Improved linting configuration for consistency

@coderabbitai

coderabbitai Bot commented Feb 24, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0d3673c and bef8bce.

📒 Files selected for processing (6)
  • .github/workflows/ci.yml
  • .shellcheckrc
  • .zshrc
  • install.sh
  • tests/local_test.sh
  • uninstall.sh

📝 Walkthrough

Walkthrough

This pull request enhances the installation and uninstallization scripts with robust cross-distro support, improved error handling, and stricter shell linting. Changes include distro-aware package management, OS-specific cleanup logic, expanded Zsh syntax checks, and a new ShellCheck configuration file for consistency across environments.

Changes

Cohort / File(s) Summary
CI Workflow Enhancement
.github/workflows/ci.yml
Broadened installation steps to install Shellcheck and Zsh together; separated linting jobs for install.sh, theme.sh, and uninstall.sh; added dedicated Zsh syntax check for .zshrc; expanded Zinit verification to multi-tool presence check across plugin directories; added system package installation for Arch and Fedora Docker tests.
Shell Linting Configuration
.shellcheckrc
Added new ShellCheck configuration file with shared ignore rules (SC2086, SC2034, SC1091) to align CI and local test environments without duplication.
Zsh Configuration Updates
.zshrc
Added cleanup of stale alias warnings for zi, zpl, zplg; introduced user-prompted safety check for Z-Shift updates comparing current and backup .zshrc; exposed new public alias zsu mapped to zshift-update.
Installation Script Refactoring
install.sh
Replaced abort-on-error with stricter error handling; added early root-check unless CI=true; introduced global cleanup mechanism for temporary directories; implemented distro-aware package installation for Debian, Arch, Fedora, OpenSUSE, and macOS; improved Eza and font installation with non-interactive handling; normalized path handling to use $HOME instead of tilde expansion; added defensive checks for shell updates and font-cache refresh.
Uninstallation Script Enhancement
uninstall.sh
Introduced OS and distro detection with conditional branches; replaced generic messages with descriptive banners; updated cleanup flow for .zshenv and Zinit data; expanded binaries removal with distro-specific package manager calls (apt, pacman, dnf, brew); added conditional FiraCode font removal for Linux and macOS; made user prompts resilient to non-TTY environments.
Test Suite Updates
tests/local_test.sh
Added script base paths (SCRIPT_DIR, REPO_ROOT) for absolute location computation; extended required files check to include theme.sh and uninstall.sh; refactored Zsh syntax check to validate $REPO_ROOT/.zshrc; simplified shellcheck invocation with loop-based aggregation; added final status line confirming all checks passed.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 Hoppy feet on distro-lands so far,
From Arch to Fedora, near and far!
With safety checks and cleanup spree,
Install and uninstall now agree.
The shell scripts dance with newfound grace,
Cross every OS, every place!

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@0xdilshan 0xdilshan marked this pull request as ready for review February 24, 2026 23:55
@0xdilshan 0xdilshan merged commit d23edc4 into main Feb 24, 2026
6 of 7 checks passed
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