From 8e8edfd5b56caad47539e19d672f6d9d30ca12e9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 1 May 2026 06:49:24 +0000 Subject: [PATCH 1/3] Initial plan From 8d9360be5a2e50450c3826dda6e2627682eff34f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 1 May 2026 06:54:41 +0000 Subject: [PATCH 2/3] Adopt chezmoi: rename .config to dot_config, add CI workflow, hook, config template, and README docs Agent-Logs-Url: https://github.com/DustinVenegas/dotfiles/sessions/0ab35366-b8a1-4d0c-86a1-641aa6f6171b Co-authored-by: DustinVenegas <282890+DustinVenegas@users.noreply.github.com> --- .chezmoi.toml.tmpl | 12 +++ .github/workflows/dotfiles-ci.yml | 97 +++++++++++++++++++ README.md | 46 ++++++++- {.config => dot_config}/kitty/kitty.conf | 0 {.config => dot_config}/nvim/.gitignore | 0 .../nvim/autoload/plug.vim | 0 .../nvim/coc-settings.json | 0 {.config => dot_config}/nvim/ginit.vim | 0 {.config => dot_config}/nvim/init.vim | 0 .../nvim/local.dotfiles.vim.template | 0 .../powershell/profile.ps1 | 0 run_once_after_verify.sh | 19 ++++ script/bootstrap.sh | 19 +++- 13 files changed, 187 insertions(+), 6 deletions(-) create mode 100644 .chezmoi.toml.tmpl create mode 100644 .github/workflows/dotfiles-ci.yml rename {.config => dot_config}/kitty/kitty.conf (100%) rename {.config => dot_config}/nvim/.gitignore (100%) rename {.config => dot_config}/nvim/autoload/plug.vim (100%) rename {.config => dot_config}/nvim/coc-settings.json (100%) rename {.config => dot_config}/nvim/ginit.vim (100%) rename {.config => dot_config}/nvim/init.vim (100%) rename {.config => dot_config}/nvim/local.dotfiles.vim.template (100%) rename {.config => dot_config}/powershell/profile.ps1 (100%) create mode 100755 run_once_after_verify.sh diff --git a/.chezmoi.toml.tmpl b/.chezmoi.toml.tmpl new file mode 100644 index 0000000..677393e --- /dev/null +++ b/.chezmoi.toml.tmpl @@ -0,0 +1,12 @@ +# chezmoi configuration template. +# See https://www.chezmoi.io/reference/configuration-file/ for all options. +# +# This file is a Go template evaluated once when chezmoi initialises. +# Sensitive values should use chezmoi secret helpers or environment variables +# rather than being stored in plain text. + +[data] + # Git identity used by gitconfig_local template (if present). + # Falls back to empty strings so chezmoi apply --dry-run works in CI. + git_user_name = "{{ env "GIT_AUTHOR_NAME" }}" + git_user_email = "{{ env "GIT_AUTHOR_EMAIL" }}" diff --git a/.github/workflows/dotfiles-ci.yml b/.github/workflows/dotfiles-ci.yml new file mode 100644 index 0000000..4b428fb --- /dev/null +++ b/.github/workflows/dotfiles-ci.yml @@ -0,0 +1,97 @@ +# dotfiles-ci.yml — smoke tests for chezmoi-managed dotfiles. +# +# Runs `chezmoi apply --dry-run` across a matrix of operating systems and +# containers to verify that all managed files can be applied without errors. +# A separate mise verification step runs when mise is available in the runner. + +name: dotfiles-ci + +on: + push: + branches: ["main", "Mac-shell-mise"] + pull_request: + branches: ["main", "Mac-shell-mise"] + +jobs: + # ── Native runners (ubuntu-latest, macos-latest) ───────────────────────── + chezmoi-dry-run: + name: chezmoi dry-run (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + + steps: + - uses: actions/checkout@v4 + + - name: Install chezmoi + run: sh -c "$(curl -fsLS get.chezmoi.io)" -- -b "$HOME/.local/bin" + + - name: Add chezmoi to PATH + run: echo "$HOME/.local/bin" >> "$GITHUB_PATH" + + - name: chezmoi apply --dry-run + env: + GIT_AUTHOR_NAME: "CI User" + GIT_AUTHOR_EMAIL: "ci@example.com" + run: | + chezmoi apply \ + --source "${{ github.workspace }}" \ + --dry-run \ + --no-tty \ + --verbose + + - name: mise verification (if available) + run: | + if command -v mise >/dev/null 2>&1; then + echo "Running mise doctor..." + mise doctor || echo "WARN: mise doctor reported issues" + else + echo "mise not found — skipping verification" + fi + + # ── Container runners (debian:latest, alpine:latest) ───────────────────── + chezmoi-dry-run-containers: + name: chezmoi dry-run (${{ matrix.container }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + container: [debian:latest, alpine:latest] + container: + image: ${{ matrix.container }} + + steps: + - name: Install dependencies (Debian/Ubuntu) + if: startsWith(matrix.container, 'debian') + run: apt-get update && apt-get install -y --no-install-recommends curl git ca-certificates + + - name: Install dependencies (Alpine) + if: startsWith(matrix.container, 'alpine') + run: apk add --no-cache curl git ca-certificates + + - uses: actions/checkout@v4 + + - name: Install chezmoi + run: sh -c "$(curl -fsLS get.chezmoi.io)" -- -b /usr/local/bin + + - name: chezmoi apply --dry-run + env: + GIT_AUTHOR_NAME: "CI User" + GIT_AUTHOR_EMAIL: "ci@example.com" + run: | + chezmoi apply \ + --source "${{ github.workspace }}" \ + --dry-run \ + --no-tty \ + --verbose + + - name: mise verification (if available) + run: | + if command -v mise >/dev/null 2>&1; then + echo "Running mise doctor..." + mise doctor || echo "WARN: mise doctor reported issues" + else + echo "mise not found — skipping verification" + fi diff --git a/README.md b/README.md index 70e79d0..ca2fd7a 100644 --- a/README.md +++ b/README.md @@ -7,19 +7,57 @@ Targets Linux, macOS, and Windows with native bootstrap scripts. Environments are configured through the magic of symlinks. ![build](https://github.com/DustinVenegas/dotfiles/actions/workflows/main.yml/badge.svg) +![dotfiles-ci](https://github.com/DustinVenegas/dotfiles/actions/workflows/dotfiles-ci.yml/badge.svg) ## Installation -Bootstrap scripts are located under `./scripts/`. Using native POSIX/PowerShell scripts avoids taking bootstrapping dependencies. +### chezmoi (recommended) -Run a bootstrap script in 'whatif' mode: +[chezmoi](https://www.chezmoi.io/) is the primary tool for applying these dotfiles. It handles per-file +mappings to XDG destinations, templating, and host-specific overrides. + +**1. Install chezmoi** + +```sh +# macOS (Homebrew) +brew install chezmoi + +# Linux / macOS (official installer) +sh -c "$(curl -fsLS get.chezmoi.io)" +``` + +**2. Apply dotfiles** + +```sh +# Initialise chezmoi from this repository and apply in one step +chezmoi init --apply DustinVenegas/dotfiles + +# Preview what would change without writing any files +chezmoi init --apply --dry-run DustinVenegas/dotfiles +``` + +**3. Verify (optional — requires [mise](https://mise.jdx.dev/))** + +The post-apply hook `run_once_after_verify.sh` runs automatically after +`chezmoi apply` when mise is on the `PATH`. To run it manually: + +```sh +mise doctor +``` + +### Legacy bootstrap scripts + +The original POSIX/PowerShell bootstrap scripts are kept for backward +compatibility. They create symlinks from this repository to `$HOME`. + +Run a bootstrap script in *whatif* mode first to preview changes: - POSIX-Based OS: `./script/bootstrap.sh --whatif --verbose` - Windows OS: `./script/bootstrap.ps1 -verbose -whatif` ## Health -Perform a basic environment health check with [`./script/check-dotfles-health.sh`](./script/check-dotfiles-health.sh). +Perform a basic environment health check with [`./script/check-dotfiles-health.sh`](./script/check-dotfiles-health.sh). ## Why PowerShell Core? @@ -92,6 +130,8 @@ Notable components included in this dotfiles repository. ## Related Projects +* [chezmoi](https://www.chezmoi.io/), the dotfile manager used to apply these configurations. +* [mise](https://mise.jdx.dev/), the dev-tools version manager used for post-apply verification. * [dotfiles](https://dotfiles.github.io/), your unofficial guide to dotfiles on GitHub. * [smkent/dotfiles](https://github.com/smkent/dotfiles), dotfiles repository of Stephen Kent. diff --git a/.config/kitty/kitty.conf b/dot_config/kitty/kitty.conf similarity index 100% rename from .config/kitty/kitty.conf rename to dot_config/kitty/kitty.conf diff --git a/.config/nvim/.gitignore b/dot_config/nvim/.gitignore similarity index 100% rename from .config/nvim/.gitignore rename to dot_config/nvim/.gitignore diff --git a/.config/nvim/autoload/plug.vim b/dot_config/nvim/autoload/plug.vim similarity index 100% rename from .config/nvim/autoload/plug.vim rename to dot_config/nvim/autoload/plug.vim diff --git a/.config/nvim/coc-settings.json b/dot_config/nvim/coc-settings.json similarity index 100% rename from .config/nvim/coc-settings.json rename to dot_config/nvim/coc-settings.json diff --git a/.config/nvim/ginit.vim b/dot_config/nvim/ginit.vim similarity index 100% rename from .config/nvim/ginit.vim rename to dot_config/nvim/ginit.vim diff --git a/.config/nvim/init.vim b/dot_config/nvim/init.vim similarity index 100% rename from .config/nvim/init.vim rename to dot_config/nvim/init.vim diff --git a/.config/nvim/local.dotfiles.vim.template b/dot_config/nvim/local.dotfiles.vim.template similarity index 100% rename from .config/nvim/local.dotfiles.vim.template rename to dot_config/nvim/local.dotfiles.vim.template diff --git a/.config/powershell/profile.ps1 b/dot_config/powershell/profile.ps1 similarity index 100% rename from .config/powershell/profile.ps1 rename to dot_config/powershell/profile.ps1 diff --git a/run_once_after_verify.sh b/run_once_after_verify.sh new file mode 100755 index 0000000..51067bc --- /dev/null +++ b/run_once_after_verify.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# run_once_after_verify.sh - Post-apply verification hook. +# +# chezmoi executes scripts whose names begin with "run_once_after_" exactly +# once, after all managed files have been applied. This script uses mise to +# verify the managed tool environment when mise is available, and exits +# gracefully when it is not. +# +# See https://www.chezmoi.io/reference/scripts/ for chezmoi script details. +# See https://mise.jdx.dev/ for mise documentation. + +set -e + +if command -v mise >/dev/null 2>&1; then + echo "chezmoi post-apply: running mise doctor..." + mise doctor || echo "WARN: mise doctor reported issues — review the output above" +else + echo "chezmoi post-apply: mise not found, skipping verification" +fi diff --git a/script/bootstrap.sh b/script/bootstrap.sh index d339f6c..c0b3f70 100755 --- a/script/bootstrap.sh +++ b/script/bootstrap.sh @@ -92,11 +92,10 @@ handleLink () { } # Environmental prerequisites -[ ! -d "$HOME/.config" ] && mkdir -p "$HOME/.config"; # non-standard xdc path? [ ! -d "$HOME/.local/share" ] && mkdir -p "$HOME/.local/share"; # non-standard xdc path? copyTemplate "$dotfiles/git/.gitconfig_local.template" "$dotfiles/dot_gitconfig_local" -copyTemplate "$dotfiles/.config/nvim/local.dotfiles.vim.template" "$dotfiles/.config/nvim/local.dotfiles.vim" +copyTemplate "$dotfiles/dot_config/nvim/local.dotfiles.vim.template" "$dotfiles/dot_config/nvim/local.dotfiles.vim" copyTemplate "$dotfiles/dot_vim/.vimrc.local.template" "$dotfiles/dot_vimrc.local" # Local links @@ -105,8 +104,13 @@ l="$dotfiles/dot_gitconfig_os" handleLink "$l" "$f" # Item list to be symlinked. -for f in "$dotfiles/." "$dotfiles"/dot_* "$dotfiles"/.config/* "$dotfiles/PSScripts" +# dot_config/* is enumerated individually to create per-directory symlinks under +# $HOME/.config/ rather than a single folder-level symlink for the whole directory. +for f in "$dotfiles/." "$dotfiles"/dot_* "$dotfiles/PSScripts" do + # Skip dot_config directory itself; its contents are handled below. + if [ "$f" = "$dotfiles/dot_config" ]; then continue; fi + # Get item information. r=$(realpath -s -q --relative-to="$dotfiles" "$f") # don't expand symlinks, quiet r=$(echo "$r" | sed "s/dot_/./") # transform dot_ to . @@ -122,4 +126,13 @@ do handleLink "$l" "$f" done +# Symlink each XDG config sub-directory individually (per-directory, not folder-level). +[ ! -d "$HOME/.config" ] && mkdir -p "$HOME/.config" +for f in "$dotfiles"/dot_config/* +do + r=$(realpath -s -q --relative-to="$dotfiles/dot_config" "$f") # relative name within dot_config + l="$HOME/.config/$r" + handleLink "$l" "$f" +done + exit $retc From 71cac395c70cb3fe208d1a61e41cc06288f22c26 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 1 May 2026 06:55:28 +0000 Subject: [PATCH 3/3] Fix: add explicit permissions: contents: read to CI workflow jobs Agent-Logs-Url: https://github.com/DustinVenegas/dotfiles/sessions/0ab35366-b8a1-4d0c-86a1-641aa6f6171b Co-authored-by: DustinVenegas <282890+DustinVenegas@users.noreply.github.com> --- .github/workflows/dotfiles-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/dotfiles-ci.yml b/.github/workflows/dotfiles-ci.yml index 4b428fb..bb837a3 100644 --- a/.github/workflows/dotfiles-ci.yml +++ b/.github/workflows/dotfiles-ci.yml @@ -17,6 +17,8 @@ jobs: chezmoi-dry-run: name: chezmoi dry-run (${{ matrix.os }}) runs-on: ${{ matrix.os }} + permissions: + contents: read strategy: fail-fast: false matrix: @@ -55,6 +57,8 @@ jobs: chezmoi-dry-run-containers: name: chezmoi dry-run (${{ matrix.container }}) runs-on: ubuntu-latest + permissions: + contents: read strategy: fail-fast: false matrix: