Skip to content

refactor(setup): restructure installer into setup/ modules - #206

Merged
codepuncher merged 17 commits into
masterfrom
refactor/setup-sh-structure
Jun 23, 2026
Merged

codepuncher merged 17 commits into
masterfrom
refactor/setup-sh-structure

Conversation

@codepuncher

Copy link
Copy Markdown
Owner

What

Restructure the installer for clearer design, behavior-preserving except two latent bug fixes.

  • Relocate the installer library out of shell/functions (which lived under shell/ but was only ever sourced by setup.sh) into a new setup/ directory split by concern: common.sh, symlinks.sh, packages-arch.sh, packages-wsl.sh, languages.sh, tools.sh, services.sh.
  • Turn setup.sh into a thin orchestrator: sources the modules, owns the y/n prompts and OS dispatch, and adds --help / --reinstall.
  • Delete shell/functions.

Bug fixes

  • backup() wrote to a hardcoded ${HOME}/.dotfiles/backups/; now uses ${SCRIPT_PATH}/backups/ (worked only when the repo lived at ~/.dotfiles).
  • reinstall_dotfiles was documented but never sourced into any shell, so it was uncallable; replaced by ./setup.sh --reinstall.

Notes

  • Function bodies moved verbatim. A few minimal, justified # shellcheck disable=... directives were added because shell/functions was never CI-linted but the new .sh files are.
  • Docs (README.md, CLAUDE.md) updated to the new layout.

Verification

  • shellcheck setup.sh setup/*.sh clean; bash -n on all files passes.
  • ./setup.sh --help and unknown-flag handling verified.
  • DRY smoke of the Arch dispatch path confirmed routing through the moved modules.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restructures the dotfiles installer by moving the previously monolithic shell/functions library into a new setup/ module layout, making setup.sh a thin orchestrator with --help and --reinstall support, while preserving behavior aside from the two stated bug fixes (backup path and reinstall entrypoint).

Changes:

  • Split installer logic into setup/*.sh modules (common, symlinks, packages, languages, tools, services) and removed shell/functions.
  • Updated setup.sh to source modules, handle CLI flags (--help, --reinstall), and orchestrate interactive flows.
  • Updated docs to reflect the new reinstall mechanism (./setup.sh --reinstall).

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
shell/functions Removed legacy installer function library (replaced by setup/ modules).
setup/common.sh Common helper functions (section output, OS detection, GitHub release tag lookup, AUR helper logic).
setup/symlinks.sh Directory initialization + backup + symlink creation logic (now uses ${SCRIPT_PATH}/backups).
setup/packages-arch.sh Arch package installation and post-install steps.
setup/packages-wsl.sh WSL/Ubuntu package installation and related setup helpers.
setup/languages.sh Language/runtime/toolchain installers (nvm/node, rustup, composer, pipx, cargo).
setup/tools.sh Tool installers (zinit, tmux TPM).
setup/services.sh Service setup functions (systemd units + MySQL bootstrap).
setup.sh New orchestrator: sources modules, provides --help/--reinstall, runs interactive flow.
README.md Docs updated to use ./setup.sh --reinstall instead of a shell function.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread setup/tools.sh Outdated
Comment thread setup/packages-wsl.sh
Comment thread setup/packages-wsl.sh
Comment thread setup/services.sh
Comment thread setup/packages-arch.sh Outdated
Comment thread setup/languages.sh Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 9 comments.

Comment thread setup/symlinks.sh
Comment thread setup/symlinks.sh Outdated
Comment thread setup/languages.sh Outdated
Comment thread setup/languages.sh
Comment thread setup/packages-arch.sh
Comment thread setup/tools.sh Outdated
Comment thread setup/tools.sh Outdated
Comment thread setup/tools.sh Outdated
Comment thread setup/tools.sh Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Comment thread setup/languages.sh Outdated
Comment thread setup/languages.sh Outdated
Comment thread setup/services.sh
Comment thread setup/languages.sh

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.

Comment thread setup/packages-wsl.sh
Comment thread setup/packages-wsl.sh
Comment thread setup.sh
Comment thread setup/services.sh
Comment thread setup/packages-arch.sh
Comment thread setup/packages-wsl.sh

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Comment thread shell/aliases
Comment thread shell/zshrc
Comment thread setup.sh
Comment thread setup/common.sh
Comment thread setup/packages-arch.sh

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Comment thread shell/aliases
Comment thread setup/packages-wsl.sh
Comment thread README.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Comment thread shell/aliases
@codepuncher
codepuncher merged commit 84c7b42 into master Jun 23, 2026
3 checks passed
@codepuncher
codepuncher deleted the refactor/setup-sh-structure branch June 23, 2026 16:59
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.

2 participants