diff --git a/.chezmoi.toml.tmpl b/.chezmoi.toml.tmpl index 92f9497a..5b9102ba 100644 --- a/.chezmoi.toml.tmpl +++ b/.chezmoi.toml.tmpl @@ -1,6 +1,7 @@ {{- /* Checks if running interactively, which is not the case for GitHub Codespaces */ -}} {{- $interactive := stdinIsATTY -}} +{{/* Set default values for non-interactive environments */}} {{- $opacity := 0.8 }} {{- $blur := 20 }} {{- $font_size := 16 }} @@ -8,65 +9,68 @@ {{- $window_height := 70 }} {{- $window_width := 180 }} {{- $refreshPeriod := 168 }} -{{- $GIT_EMAIL := "" }} +{{- $GIT_NAME := "GitHub Actions" }} +{{- $GITHUB_USERNAME := "github-actions" }} +{{- $GIT_EMAIL := "github-actions@github.com" }} +{{- $WORK_ENVIRONMENT := false }} +{{- $SHELL := "nu" }} +{{- $CATPPUCCIN_FLAVOR := "mocha" }} -{{- $GIT_NAME := promptStringOnce . "git.config.name" "👥 Git Config 👥 - Name" "Gabe Mendoza" -}} -{{- $GITHUB_USERNAME := promptStringOnce . "git.config.username" "👥 Git Config 👥 - Github Username" "thatguyinabeanie" -}} - -{{- $WORK_ENVIRONMENT := promptBoolOnce . "WORK_ENVIRONMENT" "💻 Is this environment for work" false -}} -{{ if eq $WORK_ENVIRONMENT true }} -{{- $GIT_EMAIL := promptStringOnce . "git.config.email" "👥 Git Config 👥 - Work Email" "gmendoza@civisanalytics.com" -}} -{{ else }} -{{- $GIT_EMAIL := promptStringOnce . "git.config.email" "👥 Git Config 👥 - Email" "thatguyin@beanie.gg" -}} -{{ end }} - -{{- $SHELL_OPTIONS := list "nu" "zsh" -}} -{{- $SHELL := promptChoiceOnce . "SHELL" "💻 What is your preferred shell" $SHELL_OPTIONS "nu" -}} - -{{- $CATPPUCCIN_FLAVORS := list "mocha" "macchiatto" "frappe" "latte" -}} -{{- $CATPPUCCIN_FLAVOR := promptChoiceOnce . "CATPPUCCIN_FLAVOR" "🌈 Select a Catppuccin flavor)" $CATPPUCCIN_FLAVORS "mocha" -}} +{{/* Only prompt for values in interactive mode */}} +{{- if $interactive }} + {{- $GIT_NAME = promptStringOnce . "git.config.name" "👥 Git Config 👥 - Name" (env "GIT_NAME" | default "") -}} + {{- $GITHUB_USERNAME = promptStringOnce . "git.config.username" "👥 Git Config 👥 - Github Username" (env "GITHUB_USERNAME" | default "") -}} + {{- $WORK_ENVIRONMENT = promptBoolOnce . "WORK_ENVIRONMENT" "💻 Is this environment for work" false -}} + {{- if eq $WORK_ENVIRONMENT true }} + {{- $GIT_EMAIL = promptStringOnce . "git.config.email" "👥 Git Config 👥 - Work Email" (env "GIT_EMAIL" | default "") -}} + {{- else }} + {{- $GIT_EMAIL = promptStringOnce . "git.config.email" "👥 Git Config 👥 - Email" (env "GIT_EMAIL" | default "") -}} + {{- end }} + {{- $SHELL_OPTIONS := list "nu" "zsh" -}} + {{- $SHELL = promptChoiceOnce . "SHELL" "💻 What is your preferred shell" $SHELL_OPTIONS "nu" -}} + {{- $CATPPUCCIN_FLAVORS := list "mocha" "macchiatto" "frappe" "latte" -}} + {{- $CATPPUCCIN_FLAVOR = promptChoiceOnce . "CATPPUCCIN_FLAVOR" "🌈 Select a Catppuccin flavor)" $CATPPUCCIN_FLAVORS "mocha" -}} +{{- end }} [data] SHELL = {{ $SHELL | quote }} -WORK_ENVIRONMENT = {{ $WORK_ENVIRONMENT }} - -CATPPUCCIN_FLAVOR = {{ $CATPPUCCIN_FLAVOR | quote }} - -OBSIDIAN_VAULT_PERSONAL = "obsidian-vault" -OBSIDIAN_VAULT_WORK = "obsidian-vault-work" -YAZI_CATPPUCCIN_COLOR = "blue" -SUDO_TOUCHID = "true" +WORK_ENVIRONMENT = {{ $WORK_ENVIRONMENT }} +CATPPUCCIN_FLAVOR = {{ $CATPPUCCIN_FLAVOR | quote }} +OBSIDIAN_VAULT_PERSONAL = "obsidian-vault" +OBSIDIAN_VAULT_WORK = "obsidian-vault-work" +YAZI_CATPPUCCIN_COLOR = "blue" +SUDO_TOUCHID = "true" [data.k9s] -transparent = {{ lt $opacity 1.0 }} +transparent = {{ lt $opacity 1.0 }} [data.ghostty] -window_height = {{ $window_height | quote }} -window_width = {{ $window_width | quote }} -opacity = {{ $opacity | quote }} -blur = {{ $blur | quote }} -font_size = {{ $font_size | quote }} -font_thicken = true -font_family = {{ $font_family | quote }} -cursor_style = "block_hollow" +window_height = {{ $window_height | quote }} +window_width = {{ $window_width | quote }} +opacity = {{ $opacity | quote }} +blur = {{ $blur | quote }} +font_size = {{ $font_size | quote }} +font_thicken = true +font_family = {{ $font_family | quote }} +cursor_style = "block_hollow" [data.kitty] -window_height = {{ $window_height | quote }} -window_width = {{ $window_width | quote }} -opacity = {{ $opacity | quote }} -blur = {{ $blur | quote }} -font_size = {{ $font_size | quote }} -font_family = {{ $font_family |quote }} +window_height = {{ $window_height | quote }} +window_width = {{ $window_width | quote }} +opacity = {{ $opacity | quote }} +blur = {{ $blur | quote }} +font_size = {{ $font_size | quote }} +font_family = {{ $font_family | quote }} [data.git.config] -name = {{ $GIT_NAME | quote }} -username = {{ $GITHUB_USERNAME | quote }} -email = {{ $GIT_EMAIL | quote }} -defaultRefreshPeriod = "{{ $refreshPeriod }}h" +name = {{ $GIT_NAME | quote }} +username = {{ $GITHUB_USERNAME | quote }} +email = {{ $GIT_EMAIL | quote }} +defaultRefreshPeriod = "{{ $refreshPeriod }}h" [data.install] -obsidia = true +obsidia = true [warnings] - configFileTemplateHasChanged = false +configFileTemplateHasChanged = false diff --git a/.chezmoidata/gitrepos.yaml b/.chezmoidata/gitrepos.yaml index 05187c66..3a78b65d 100644 --- a/.chezmoidata/gitrepos.yaml +++ b/.chezmoidata/gitrepos.yaml @@ -6,23 +6,19 @@ gitrepos: - org: duffney name: smart-notes refreshPeriod: 3h - public: - name: DOOM-fire-zig - org: const-void - + org: const-void personal: - name: game-of-life refreshPeriod: 168h - private: - name: personal-notes org: personal refreshPeriod: 1h - work: - repos: + repos: - console - - popsicle - obsidian: + - popsicle + obsidian: - obsidian-vault-work diff --git a/.chezmoidata/homebrew.yaml b/.chezmoidata/homebrew.yaml index 1d7cfd51..d02109e7 100644 --- a/.chezmoidata/homebrew.yaml +++ b/.chezmoidata/homebrew.yaml @@ -14,10 +14,7 @@ homebrew: - mysql - mysql-client - okta-aws-cli - - python@3.11 - python-gdbm@3.11 - - python@3.9 - - python@3.12 - v8 casks: - aws-vpn-client @@ -58,7 +55,6 @@ homebrew: - homebrew/autoupdate - jesseduffield/lazydocker - nikitabobko/tap - - oven-sh/bun fonts: - font-cascadia-code-nf - font-caskaydia-cove-nerd-font @@ -87,7 +83,6 @@ homebrew: - zed brews: - ack - - act - ag - autoconf - automake @@ -96,20 +91,16 @@ homebrew: - bash-completion - bash-language-server - bat - - bottom - brew-cask-completion - btop - bundler-completion - chezmoi - - cmake - cmake-docs - cspell - - colima - colordiff - coreutils - charmbracelet/tap/mods - curl - - deno - diff-so-fancy - direnv - docutils @@ -118,49 +109,39 @@ homebrew: - dotdrop - dust - exiftool - - eza - fastfetch - - fd - fish - fish-lsp - ffmpeg - findutils - fontconfig - - fzf - gcc - gcc@11 - gcc@12 - gem-completion - - gradle-completion - gdu - - gh - glib - gifsicle - git - - gitui - git-delta - glances - gnu-indent - gnu-sed - gnu-tar - gmp - - go - gping - grep - grpc - grex - - hadolint - harfbuzz - hashicorp/tap/packer - helix - - helm - hyperfine - imagemagick - incus - jaq - jesseduffield/lazydocker/lazydocker - jq - - kubernetes-cli - launchctl-completion - libtool - llvm @@ -169,22 +150,18 @@ homebrew: - libffi - libgit2 - libpq - - lima - links - lua - - lua-language-server - luajit - luarocks + - lua-language-server - lynx - make - man2html - markdown-toc - - markdownlint-cli2 - markdown-oxide - marksman - mas - - maven - - maven-completion - mise - ncdu - neovim @@ -194,15 +171,13 @@ homebrew: - open-completion - ossp-uuid - openssl@3 - - oven-sh/bun/bun - pandoc - pkgconf - - pnpm - poppler - prettier + - pre-commit - procs - proctools - - python@3.13 - pyright - rails-completion - rake-completion @@ -213,7 +188,6 @@ homebrew: - ripgrep - rlwrap - readline - - rustup - rust-analyzer - ruby-completion - sesh @@ -222,7 +196,6 @@ homebrew: - sdl2 - sk - starship - - stylua - tealdeer - tflint - thefuck @@ -239,10 +212,10 @@ homebrew: - usage - wget - xz - - yaml-language-server - yamlfix - yamlfmt - yamllint + - yaml-language-server - yazi - yq - zls diff --git a/.chezmoidata/mise.yaml b/.chezmoidata/mise.yaml index 411a5693..0cad62db 100644 --- a/.chezmoidata/mise.yaml +++ b/.chezmoidata/mise.yaml @@ -1,5 +1,34 @@ mise: tools: + - name: act + version: latest + - name: bottom + version: latest + - name: erlang + version: latest + - name: elixir + version: latest + # Removed elixir-ls as it's better managed through Mason + - name: delta + version: latest + - name: eza + version: latest + - name: fastfetch + version: latest + - name: fzf + version: latest + - name: fd + version: latest + - name: github-cli + version: latest + - name: gitleaks + version: latest + - name: gitui + version: latest + - name: gitsign + version: latest + - name: github-markdown-toc + version: latest - name: node version: 22 - name: ruby @@ -8,9 +37,50 @@ mise: version: 3.12 - name: go version: 1 + - name: golangci-lint + version: latest + - name: golangci-lint-langserver + version: latest - name: uv version: latest - name: ruff version: latest - name: zig version: latest + # Development Languages & Runtimes + - name: rust + version: nightly + - name: deno + version: latest + - name: bun + version: latest + - name: lua + version: latest + # Package Managers + - name: pnpm + version: latest + - name: yarn + version: latest + - name: poetry + version: latest + - name: pipx + version: latest + # Development Tools + - name: cargo-binstall + version: latest + - name: stylua + version: latest + - name: terraform + version: latest + - name: kubectl + version: latest + - name: helm + version: latest + - name: gradle + version: latest + - name: cmake + version: latest + - name: shellcheck + version: latest + - name: hadolint + version: latest diff --git a/.chezmoidata/treesitter.yaml b/.chezmoidata/treesitter.yaml new file mode 100644 index 00000000..c830ff4a --- /dev/null +++ b/.chezmoidata/treesitter.yaml @@ -0,0 +1,58 @@ +treesitter: + ensure_installed: + - bash + - cmake + - comment + - csv + - diff + - dockerfile + - dot + - embedded_template + - elixir + - git_config + - gitignore + - gleam + - gpg + - graphql + - html + - java + - javascript + - json + - jq + - kotlin + - llvm + - lua + - luadoc + - latex + - markdown + - markdown_inline + - nu + - nix + - nginx + - norg + - python + - proto + - query + - readline + - r + - regex + - rust + - ruby + - ssh_config + - swift + - svelte + - superhtml + - sql + - scss + - scala + - toml + - tsx + - typescript + - tmux + - typst + - terraform + - vim + - vimdoc + - xml + - yaml + - zig diff --git a/.chezmoiexternal.toml.tmpl b/.chezmoiexternal.toml.tmpl index 1388028c..9d28ed1f 100644 --- a/.chezmoiexternal.toml.tmpl +++ b/.chezmoiexternal.toml.tmpl @@ -7,19 +7,22 @@ type = "git-repo" refreshPeriod = "168h" url = "https://github.com/const-void/DOOM-fire-zig.git" +{{ if hasKey . "git.config.username" }} ## ## PRIVATE GITHUB REPOSITORIES ## ["source/dotfiles"] type = "git-repo" refreshPeriod = "168h" -url = "https://github.com/{{ $.git.config.username }}/dotfiles.git" +url = "https://github.com/{{ .git.config.username }}/dotfiles.git" ["source/github-profile"] type = "git-repo" refreshPeriod = "168h" -url = "https://github.com/{{ $.git.config.username }}/{{$.git.config.username }}.git" +url = "https://github.com/{{ .git.config.username }}/{{ .git.config.username }}.git" ## -## TODO: Populate work repository entries +##kTODO: Populate work repository entries ## + +{{ end }} diff --git a/.chezmoiignore b/.chezmoiignore index b573ffd1..9e42d711 100644 --- a/.chezmoiignore +++ b/.chezmoiignore @@ -36,4 +36,13 @@ tmux/ nvim/ nushell/ obsidian/ +tests/ + install.sh + +coverage.txt +go.mod +go.sum +CONTRIBUTING.md +SECURITY.md +gitleaks-report.json diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..e2074975 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,28 @@ +--- +name: Bug Report +about: Create a report to help improve the dotfiles +title: '[BUG] ' +labels: bug +assignees: '' +--- + +**Description** +A clear description of the bug. + +**To Reproduce** +Steps to reproduce the behavior: +1. +2. +3. + +**Expected Behavior** +What you expected to happen. + +**Environment** + +- OS: [e.g., macOS 13.0] +- Shell: [e.g., Nushell 0.80] +- Chezmoi version: [e.g., 2.34.0] + +**Additional Context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..343de5dd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,19 @@ +--- +name: Feature Request +about: Suggest an idea for the dotfiles +title: '[FEATURE] ' +labels: enhancement +assignees: '' +--- + +**Problem** +A clear description of what the problem is. + +**Proposed Solution** +A clear description of what you want to happen. + +**Alternatives Considered** +A clear description of any alternative solutions you've considered. + +**Additional Context** +Add any other context about the feature request here diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..a509f9ea --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,27 @@ +## Description + +Brief description of the changes. + +## Type of Change + +- [ ] Bug fix +- [ ] New feature +- [ ] Documentation update +- [ ] Configuration change +- [ ] Breaking change + +## Testing + +Describe the tests you ran: + +1. +2. +3. + +## Checklist + +- [ ] My code follows the style guidelines +- [ ] I have performed a self-review +- [ ] I have updated the documentation +- [ ] I have added tests that prove my fix/feature works +- [ ] All new and existing tests pass diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index 813487b5..00000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,21 +0,0 @@ -name: ci - -on: - push: - pull_request: - -jobs: - clone-and-install: - runs-on: ubuntu-latest - container: - image: mcr.microsoft.com/vscode/devcontainers/base:ubuntu - env: - CODESPACES: true - steps: - - uses: actions/checkout@v2 - - name: instahh.sh - if: false - run: ./install.sh - - name: chezmoi data - if: false - run: "${HOME}/.local/bin/chezmoi data" diff --git a/.github/workflows/cspell.yaml b/.github/workflows/cspell.yaml deleted file mode 100644 index 57f5677b..00000000 --- a/.github/workflows/cspell.yaml +++ /dev/null @@ -1,27 +0,0 @@ -name: 'Check spelling' -on: # rebuild any PRs and main branch changes - pull_request: - push: - branches: - - main -jobs: - spellcheck: # run the action - name: Spell Check - runs-on: ubuntu-latest - timeout-minutes: 5 - permissions: - contents: read - pull-requests: write # Allows the action to comment on PRs - steps: - - uses: actions/checkout@v4 - - uses: streetsidesoftware/cspell-action@v6 - if: false - with: - # Inline PR comments instead of annotations - inline: warning - # Fail on warnings - strict: true - # Show progress - verbose: true - suggestions: true - diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..5f95612b --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,54 @@ +--- +name: Lint + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.21' + cache: true + + - name: Run golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: latest + args: --out-format=colored-line-number + + - name: Check YAML formatting + uses: ibiqlik/action-yamllint@v3 + if: always() + with: + file_or_dir: . + config_file: .yamllint.yml + + - name: Lint Shell Scripts + if: always() + uses: ludeeus/action-shellcheck@master + with: + scandir: '.chezmoiscripts' + + - name: Run markdownlint + if: always() + uses: nosborn/github-action-markdown-cli@v3.3.0 + with: + files: "*.md" + config_file: ".markdownlint.json" + + - name: Check for broken links + if: always() + uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + use-quiet-mode: 'yes' + config-file: '.markdown-link-check.json' diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml new file mode 100644 index 00000000..d9758e56 --- /dev/null +++ b/.github/workflows/security.yml @@ -0,0 +1,78 @@ +--- +name: Security +on: + push: + branches: [main] + pull_request: + branches: [main] + schedule: + - cron: "0 0 * * *" + +permissions: + contents: read + security-events: write + actions: read + pull-requests: read + +jobs: + # codeql: + # name: Analyze + # runs-on: ubuntu-latest + # permissions: + # actions: read + # contents: read + # security-events: write + # + # strategy: + # fail-fast: false + # matrix: + # language: ['go'] + # + # steps: + # - name: Checkout repository + # uses: actions/checkout@v4 + # + # - name: Initialize CodeQL + # uses: github/codeql-action/init@v2 + # with: + # languages: ${{ matrix.language }} + # + # - name: Autobuild + # uses: github/codeql-action/autobuild@v2 + # + # - name: Perform CodeQL Analysis + # uses: github/codeql-action/analyze@v2 + # with: + # category: "/language:${{matrix.language}}" + security: + name: Security Scan + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Run Gitleaks + uses: gitleaks/gitleaks-action@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Run Trivy vulnerability scanner + uses: aquasecurity/trivy-action@master + with: + scan-type: "fs" + ignore-unfixed: true + format: "table" + exit-code: "1" + severity: "CRITICAL,HIGH" + hide-progress: false + + # To enable SARIF uploads, enable code scanning in repository settings: + # Settings -> Code security and analysis -> Code scanning + # Then change format back to "sarif" and uncomment the upload step + # - name: Upload Trivy scan results to GitHub Security tab + # uses: github/codeql-action/upload-sarif@v3 + # if: always() + # with: + # sarif_file: "trivy-results.sarif" + # category: "trivy" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..4c874cd6 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,32 @@ +--- +name: Tests + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + name: Chezmoi + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.21' + cache: true + + - name: Install dependencies + run: go mod download + + - name: Run all tests + run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./tests/... + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + file: ./coverage.txt diff --git a/.gitignore b/.gitignore index cb6991ab..40bdc06a 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ secrets/* k9s/* !k9s/config.yaml !k9s/skins/* - +coverage.txt +gitleaks-report.json diff --git a/.markdown-link-check.json b/.markdown-link-check.json new file mode 100644 index 00000000..c5c720ac --- /dev/null +++ b/.markdown-link-check.json @@ -0,0 +1,15 @@ +{ + "ignorePatterns": [ + { + "pattern": "^http://localhost" + }, + { + "pattern": "^https://github\\.com/.+/actions/workflows/.+/badge\\.svg" + } + ], + "replacementPatterns": [], + "timeout": "20s", + "retryOn429": true, + "retryCount": 5, + "fallbackRetryDelay": "30s" +} diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 00000000..4e32eaee --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,22 @@ +{ + "default": true, + "MD013": { + "line_length": 100, + "code_blocks": false, + "tables": false + }, + "MD033": { + "allowed_elements": ["a", "img", "br", "hr", "code", "pre"] + }, + "MD041": false, + "MD024": { + "siblings_only": true + }, + "MD026": { + "punctuation": ".,;:!" + }, + "MD029": { + "style": "ordered" + }, + "MD036": false +} diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 00000000..29fe02db --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,10 @@ +--- +extends: default +rules: + line-length: + max: 120 + level: warning + truthy: + check-keys: false + document-start: disable + new-line-at-end-of-file: enable diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..3aa63f2d --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,50 @@ +# Contributing to Dotfiles + +Thank you for your interest in contributing! This document outlines the process for contributing. + +## Getting Started + +1. Fork the repository +2. Create a new branch for your feature/fix +3. Make your changes +4. Test your changes +5. Submit a pull request + +## Development Setup + +1. Install Chezmoi: + +```zsh +sh -c "$(curl -fsLS get.chezmoi.io)" +``` + +1. Clone the repository: + +```zsh +chezmoi init --apply your_github_username +``` + +## Testing + +- Run integration tests: + +```zsh +go test -v ./tests/... +``` + +- Test installation on a fresh system +- Verify all GitHub Actions pass + +## Pull Request Process + +1. Update documentation if needed +2. Add tests for new features +3. Ensure all tests pass +4. Update the README.md if needed +5. Reference any related issues + +## Code Style + +- Follow existing code formatting +- Use meaningful commit messages +- Keep changes focused and atomic diff --git a/README.md b/README.md index d7e90b22..21647d6c 100644 --- a/README.md +++ b/README.md @@ -1,94 +1,129 @@ -# Dotfiles +# 🏠 Dotfiles -My personal dotfiles managed with [Chezmoi](https://www.chezmoi.io/), featuring a modern and efficient development environment setup. +My personal dotfiles managed with [Chezmoi](https://www.chezmoi.io/), featuring a modern and +efficient development environment setup. -## Components +![Shell](https://img.shields.io/badge/Shell-Nushell-blue?style=flat-square&logo=gnu-bash) +![Editor](https://img.shields.io/badge/Editor-Neovim-green?style=flat-square&logo=neovim) +![Theme](https://img.shields.io/badge/Theme-Catppuccin-pink?style=flat-square) +![License](https://img.shields.io/badge/License-MIT-yellow?style=flat-square) +![Tests](https://github.com/thatguyinabeanie/dotfiles/actions/workflows/test.yml/badge.svg) +![Lint](https://github.com/thatguyinabeanie/dotfiles/actions/workflows/lint.yml/badge.svg) +![Security](https://github.com/thatguyinabeanie/dotfiles/actions/workflows/security.yml/badge.svg) -### Shell Environment -- [Nushell Configuration](dot_config/nushell/README.md) +[Screenshot of setup] + +## ✨ Components + +### 🐚 Shell Environment + +- [**Nushell Configuration**](dot_config/nushell/README.md) - Modern shell with enhanced features - Custom aliases and functions - Work environment integration -### Development Tools -- [Neovim Configuration](dot_config/nvim/README.md) +### 🛠️ Development Tools + +- [**Neovim Configuration**](dot_config/nvim/README.md) - LazyVim-based setup - Catppuccin theme - LSP integration - Git integration -- [Git Configuration](dot_config/git/README.md) +- [**Git Configuration**](dot_config/git/README.md) - Custom aliases - Git hooks - Global settings -### Terminal Tools -- [Tmux Configuration](dot_config/tmux/README.md) +### 📟 Terminal Tools + +- [**Tmux Configuration**](dot_config/tmux/README.md) - Catppuccin theme - Pomodoro timer - Custom keybindings - Session management -### Knowledge Management -- [Obsidian Configuration](dot_config/obsidian/README.md) +### 📚 Knowledge Management + +- [**Obsidian Configuration**](dot_config/obsidian/README.md) - Multiple vault support - Neovim integration - Plugin configuration -## Installation +## 📥 Installation -1. Install Chezmoi: - ```bash - brew install chezmoi - ``` +```zsh +sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply thatguyinabeanie +``` -2. Clone this repository: - ```bash - chezmoi init --apply - ``` +### Configuration Variables -3. Install dependencies: - ```bash - mise install - ``` +During installation, you'll be prompted for several configuration values: -## Structure +| Variable | Description | Default | +|----------|-------------|---------| +| `WORK_ENVIRONMENT` | Enable work-specific configurations | `false` | +| `SHELL` | Preferred shell (nu/zsh) | `nu` | +| `CATPPUCCIN_FLAVOR` | Theme variant (mocha/macchiato/frappe/latte) | `mocha` | +| `GIT_NAME` | Git commit author name | - | +| `GIT_EMAIL` | Git commit author email | - | +| `GITHUB_USERNAME` | GitHub username | - | -``` -. -├── dot_config/ -│ ├── nushell/ # Shell configuration -│ ├── nvim/ # Neovim configuration -│ ├── git/ # Git configuration -│ ├── tmux/ # Tmux configuration -│ └── obsidian/ # Obsidian configuration -└── scripts/ # Custom scripts -``` +## 📂 Structure -## Features +## 🎯 Features -- **Modern Development Environment** - - Nushell for enhanced shell experience - - Neovim for efficient editing - - Tmux for terminal multiplexing - - Git for version control +### 🚀 Modern Development Environment -- **Knowledge Management** - - Obsidian for note-taking - - Multiple vault support - - Neovim integration +- Nushell for enhanced shell experience +- Neovim for efficient editing +- Tmux for terminal multiplexing +- Git for version control -- **Productivity Tools** - - Pomodoro timer - - Custom aliases - - Work environment integration +### 📝 Knowledge Management + +- Obsidian for note-taking +- Multiple vault support +- Neovim integration + +### ⚡ Productivity Tools + +- Pomodoro timer +- Custom aliases +- Work environment integration + +## 🔒 Security Features + +### TODO: Pre-commit Hooks + +This repository automatically sets up pre-commit hooks when you run `chezmoi init --apply`. +These hooks include: + +- **Gitleaks**: Scans staged files for potential secrets or sensitive information +- **Basic checks**: Trailing whitespace, YAML validation, etc. + +The hooks are installed globally in `~/.config/git/hooks` and will be available for all your repositories. + +### Manual Security Scan + +To manually run a security scan: + +```bash +pre-commit run --all-files +``` + +or specifically for secrets: + +```bash +gitleaks detect --source . --verbose +``` -## Dependencies +## 📦 Dependencies -- [Chezmoi](https://www.chezmoi.io/) - Dotfiles manager -- [mise](https://github.com/jdx/mise) - Tool version manager -- [Homebrew](https://brew.sh/) - Package manager +- [**Chezmoi**](https://www.chezmoi.io/) - Dotfiles manager +- [**mise**](https://github.com/jdx/mise) - Tool version manager +- [**Homebrew**](https://brew.sh/) - Package manager -## Contributing +## 🤝 Contributing Feel free to submit issues and enhancement requests! diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..786b271a --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,26 @@ +# Security Policy + +## Reporting a Vulnerability + +If you discover a security vulnerability, please follow these steps: + +1. **Do Not** open a public issue +2. Email the vulnerability details to [your-email] +3. Include: + - Description of the vulnerability + - Steps to reproduce + - Potential impact + - Suggested fix (if any) + +## Security Measures + +This repository: + +- Uses Gitleaks for secrets scanning +- Employs Trivy for vulnerability scanning +- Implements CodeQL analysis +- Uses Dependabot for dependency updates + +## Supported Versions + +Only the latest version is supported with security updates. diff --git a/dot_config/btop/run_onchange_after_themes.nu b/dot_config/btop/run_onchange_after_themes.nu deleted file mode 100644 index 1dc02ebb..00000000 --- a/dot_config/btop/run_onchange_after_themes.nu +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env nu - -print "🟠 Rebuilding bat themes..." -bat cache --build | save --append /dev/null -print "🔵 Rebuilt bat themes." diff --git a/dot_config/git/README.md b/dot_config/git/README.md index 74876cf7..8b94b7b9 100644 --- a/dot_config/git/README.md +++ b/dot_config/git/README.md @@ -5,6 +5,7 @@ A comprehensive Git configuration with custom aliases, hooks, and settings for e ## Features - **Custom Aliases** + - Quick access to common Git commands - Enhanced workflow shortcuts - Repository management helpers @@ -23,6 +24,7 @@ A comprehensive Git configuration with custom aliases, hooks, and settings for e ## Configuration Structure The configuration is managed through Chezmoi templates: + - `config.tmpl` - Main Git configuration (Chezmoi template) - `.chezmoiexternal.toml` - External template configuration - `dot_gitignore` - Global gitignore patterns @@ -30,32 +32,40 @@ The configuration is managed through Chezmoi templates: ## Installation 1. Clone this configuration using Chezmoi: - ```bash + + ```zsh chezmoi init --apply ``` 2. Ensure Git is installed: - ```bash + + ```zsh brew install git ``` ## Customization ### Global Settings + The configuration includes: + - Default editor settings - Branch naming conventions - Commit message templates - GPG signing configuration ### Git Hooks + Custom hooks are available for: + - Pre-commit checks - Post-merge actions - Workflow automation ### Aliases + Common Git aliases include: + - Quick status checks - Branch management - Commit shortcuts @@ -69,4 +79,4 @@ Common Git aliases include: ## Contributing -Feel free to submit issues and enhancement requests! \ No newline at end of file +Feel free to submit issues and enhancement requests! diff --git a/dot_config/git/config.tmpl b/dot_config/git/config.tmpl index 429f8fbf..b13a8e08 100644 --- a/dot_config/git/config.tmpl +++ b/dot_config/git/config.tmpl @@ -2,11 +2,11 @@ path = ./.catppuccin/catppuccin.gitconfig [user] - name = {{ .git.config.name }} - email = {{ .git.config.email }} + name = {{ .git.config.name }} + email = {{ .git.config.email }} [push] - autoSetupRemote = true + autoSetupRemote = true [core] editor = nvim @@ -14,10 +14,10 @@ excludesFile = ~/.config/git/.gitignore [commit] - gpgsign = false + gpgsign = false [init] - defaultBranch = main + defaultBranch = main [interactive] diffFilter = delta --color-only diff --git a/dot_config/git/hooks/.keep b/dot_config/git/hooks/.keep new file mode 100644 index 00000000..e69de29b diff --git a/dot_config/gitleaks/config.toml b/dot_config/gitleaks/config.toml new file mode 100644 index 00000000..e7da5c25 --- /dev/null +++ b/dot_config/gitleaks/config.toml @@ -0,0 +1,34 @@ +# Gitleaks configuration file +title = "Gitleaks Configuration" + +[extend] +useDefault = true # Extend the default rule set + +[allowlist] +description = "Global Allowlist" +paths = [ + '''.*\.snapshot''', + '''.*\.env\.example$''', + '''.*\.test$''', + '''(.*?)(jpg|gif|doc|pdf|bin|svg|zip)$''', +] + +regexes = [ + '''(?i)example|test|mock|dummy''', +] + +[allowlist.commits] +description = "Allowed commits" +commits = [ + # Add any commit hashes to allowlist here +] + +# Custom rules in addition to default ones +[[rules]] +id = "chezmoi-template-token" +description = "Detect hardcoded tokens in chezmoi templates" +regex = '''(?i)(?P(secret|token|password|credential|api[_-]?key))(?:[_-])?=[\s]*["']?(?P[0-9a-zA-Z\-_=+/]{16,})["']?''' +tags = ["key", "chezmoi"] +file-types = [".tmpl"] +entropy = 3.5 +secret-group = 2 \ No newline at end of file diff --git a/dot_config/gitleaks/dot_gitleaksignore b/dot_config/gitleaks/dot_gitleaksignore new file mode 100644 index 00000000..f4880c43 --- /dev/null +++ b/dot_config/gitleaks/dot_gitleaksignore @@ -0,0 +1,43 @@ +# Version control +.git/ +.github/ + +# Build directories +**/dist/ +**/build/ +**/target/ + +# Dependencies +**/node_modules/ +**/vendor/ + +# Test files +**/*_test.go +**/*.test.ts +**/*.spec.js + +# Documentation +**/docs/ +**/*.md + +# Example files +**/*.example +**/*.sample + +# Binary and media files +**/*.jpg +**/*.png +**/*.gif +**/*.pdf +**/*.zip +**/*.tar.gz + +# Specific to your dotfiles +wallpapers/ +backups/ +coverage.txt +gitleaks-report.json + +# Template files that might contain fake credentials +**/*.example.tmpl +**/example.*.tmpl \ No newline at end of file diff --git a/dot_config/mise/config.toml.tmpl b/dot_config/mise/config.toml.tmpl index ec2f2f35..b04f63a8 100644 --- a/dot_config/mise/config.toml.tmpl +++ b/dot_config/mise/config.toml.tmpl @@ -6,7 +6,7 @@ {{- end }} [settings] -jobs = 4 # number of plugins or runtimes to install in parallel. The default is `4`. +jobs = {{ sub (output "sysctl" "-n" "hw.ncpu" | trim | atoi) 2 }} # number of plugins or runtimes to install in parallel always_keep_download = false # deleted after install by default http_timeout = "30s" # set the timeout for http requests as duration string, see `MISE_HTTP_TIMEOUT` diff --git a/dot_config/mise/run_onchange_after_config-toml.nu.tmpl b/dot_config/mise/run_onchange_after_config-toml.nu.tmpl index e06e0060..fda4df19 100644 --- a/dot_config/mise/run_onchange_after_config-toml.nu.tmpl +++ b/dot_config/mise/run_onchange_after_config-toml.nu.tmpl @@ -5,6 +5,9 @@ # mise.toml hash: {{ include "dot_config/mise/config.toml.tmpl" | sha256sum }} print "🟠 Installing mise dependencies..." -mise -q install +mise install print "🔵 Installed mise dependencies." +print "🟠 Rebuilding bat themes..." +bat cache --build | save --append /dev/null +print "🔵 Rebuilt bat themes." diff --git a/dot_config/nushell/README.md b/dot_config/nushell/README.md index 7eb2e682..16b3d795 100644 --- a/dot_config/nushell/README.md +++ b/dot_config/nushell/README.md @@ -1,10 +1,14 @@ # Nushell Configuration -This repository contains my personal Nushell configuration, featuring a modern and efficient shell setup with various customizations and integrations. The configuration is managed using [Chezmoi](https://www.chezmoi.io/), a dotfiles manager that allows for template-based configuration. +This repository contains my personal Nushell configuration, featuring a modern +and efficient shell setup with various customizations and integrations. +The configuration is managed using [Chezmoi](https://www.chezmoi.io/), +a dotfiles manager that allows for template-based configuration. ## Configuration Structure All Nushell configuration files are Chezmoi templates with the `.nu.tmpl` extension: + - `config.nu.tmpl` - Main configuration file - `aliases.nu.tmpl` - Custom aliases and functions - `env.nu.tmpl` - Environment variables @@ -42,17 +46,20 @@ All Nushell configuration files are Chezmoi templates with the `.nu.tmpl` extens ## Aliases ### Directory Navigation + - `l` - List directory contents - `ll` - List all files (including hidden) - `la` - List all files with details ### Chezmoi + - `chezmoi_update` - Update dotfiles excluding scripts - `cia` - Quick apply dotfiles - `chezmoi_data` - View Chezmoi configuration - `chezmoi_data_edit` - Edit Chezmoi configuration ### Other + - `y` - Launch Yazi file manager - `cat` - Use `bat` for file viewing - `tks` - Kill tmux server @@ -60,6 +67,7 @@ All Nushell configuration files are Chezmoi templates with the `.nu.tmpl` extens ## Custom Functions ### GitHub Management + - `gh-create-repo` - Create new repositories - `gh-clone-repo` - Clone repositories - `gh-list-repos` - List repositories @@ -68,6 +76,7 @@ All Nushell configuration files are Chezmoi templates with the `.nu.tmpl` extens - `gh-open-repo` - Open repository in browser ### System Management + - `poke_system_info` - Display system information with random Pokemon - `reset_nvim` - Reset Neovim configuration - `obsidian_nvim` - Open Obsidian vault in Neovim @@ -82,28 +91,32 @@ All Nushell configuration files are Chezmoi templates with the `.nu.tmpl` extens - [Neovim](https://neovim.io/) - [Yazi](https://github.com/sxyazi/yazi) - [bat](https://github.com/sharkdp/bat) -- [pokeget](https://github.com/taylorskalyo/kuro) +- [pokeget](https://github.com/talwat/pokeget) - [fastfetch](https://github.com/fastfetch-cli/fastfetch) ## Installation 1. Clone this repository using Chezmoi: - ```bash + + ```zsh chezmoi init --apply ``` 2. Configure Chezmoi data (if not already done): - ```bash + + ```zsh chezmoi data ``` 3. Ensure all dependencies are installed: - ```bash + + ```zsh mise install ``` 4. Restart your shell or source the configuration: - ```bash + + ```zsh source ~/.config/nushell/config.nu ``` diff --git a/dot_config/nushell/env.nu.tmpl b/dot_config/nushell/env.nu.tmpl index b5e38cdc..865a3f73 100644 --- a/dot_config/nushell/env.nu.tmpl +++ b/dot_config/nushell/env.nu.tmpl @@ -8,7 +8,7 @@ $env.PATH = ($env.PATH | '/usr/local/bin' '/opt/homebrew/opt/libpq/bin' "/Library/Developer/CommandLineTools/usr/bin" - $env.HOME | path join ".cargo/bin" + ($env.HOME | path join ".cargo/bin") ] | uniq ) @@ -53,6 +53,9 @@ $env.GOBIN = $env.GOPATH | path join "bin" $env.DOTFILES_DIR = $env.XDG_DATA_HOME | path join "chezmoi" $env.WORK_ENVIRONMENT = "{{ .WORK_ENVIRONMENT }}" $env.GIT_CLONE_DIRECTORY = $env.XDG_HOME | path join "source" +$env.GIT_NAME = "{{ .git.config.name }}" +$env.GITHUB_USERNAME = "{{ .git.config.username }}" +$env.GIT_EMAIL = "{{ .git.config.email }}" ## ## HOMEBREW BREWFILE PATH @@ -86,3 +89,12 @@ $env.STARSHIP_CONFIG = $env.XDG_CONFIG_HOME | path join "starship/starship.toml" ## $env.BAT_THEME = "Catppuccin {{ title .CATPPUCCIN_FLAVOR }}" $env.MANPAGER = "sh -c 'sed -u -e \"s/\\x1B[[0-9;]*m//g; s/.\\x08//g\" | bat -p -lman'" + +## +## CODE COMPANION NVIM +## +$env.CODECOMPANION_TOKEN_PATH = $env.XDG_CONFIG_HOME; + +## +## GIT/GITHUB +## diff --git a/dot_config/nvim/README.md b/dot_config/nvim/README.md index b33f690d..17a18419 100644 --- a/dot_config/nvim/README.md +++ b/dot_config/nvim/README.md @@ -1,6 +1,7 @@ # Neovim Configuration -A modern Neovim configuration built on top of LazyVim, featuring a beautiful and functional setup with various plugins and customizations. +A modern Neovim configuration built on top of LazyVim, +featuring a beautiful and functional setup with various plugins and customizations. ## Features @@ -30,12 +31,14 @@ A modern Neovim configuration built on top of LazyVim, featuring a beautiful and ## Plugin Highlights ### Core Plugins + - [LazyVim](https://github.com/LazyVim/LazyVim) - Base configuration - [Catppuccin](https://github.com/catppuccin/nvim) - Beautiful theme - [Bufferline](https://github.com/akinsho/bufferline.nvim) - Tab management - [Lualine](https://github.com/nvim-lualine/lualine.nvim) - Status line ### Git Integration + - [blame.nvim](https://github.com/FabijanZulj/blame.nvim) - Git blame with virtual text - Custom date format - Virtual text style @@ -43,6 +46,7 @@ A modern Neovim configuration built on top of LazyVim, featuring a beautiful and - Custom mappings ### UI Enhancements + - [snacks.nvim](https://github.com/folke/snacks.nvim) - UI enhancements - Big file handling - Dashboard customization @@ -61,18 +65,21 @@ A modern Neovim configuration built on top of LazyVim, featuring a beautiful and 1. Ensure you have Neovim installed (version 0.9.0 or higher) 2. Clone this configuration using Chezmoi: - ```bash + + ```zsh chezmoi init --apply ``` 3. Start Neovim and let Lazy.nvim install all plugins: - ```bash + + ```zsh nvim ``` ## Configuration Structure The configuration is organized as follows: + - `init.lua.tmpl` - Main configuration file (Chezmoi template) - `lua/plugins/` - Plugin configurations - `theme.lua` - Theme and UI settings @@ -82,14 +89,18 @@ The configuration is organized as follows: ## Customization ### Theme + The configuration uses Catppuccin theme with the following features: + - Transparent background - Mocha flavor - Custom styles for comments and conditionals - LSP integration with custom virtual text styles ### Git Blame + Custom git blame configuration includes: + - Date format: DD.MM.YYYY - Virtual text style - Custom key mappings: @@ -100,7 +111,9 @@ Custom git blame configuration includes: - `` or `q` - Close ### UI Enhancements + Snacks.nvim provides various UI improvements: + - Big file handling - Dashboard customization - Git browse integration diff --git a/dot_config/nvim/lua/plugins/llm/codecompanion.lua b/dot_config/nvim/lua/plugins/llm/codecompanion.lua index 1090d6ae..a44a629c 100644 --- a/dot_config/nvim/lua/plugins/llm/codecompanion.lua +++ b/dot_config/nvim/lua/plugins/llm/codecompanion.lua @@ -3,16 +3,17 @@ return { { "olimorris/codecompanion.nvim", - opts = { - llm = { - provider = "copilot", - model = "claude-3-sonnet-20240229", - } - }, dependencies = { "nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter", "zbirenbaum/copilot.lua", + "saghen/blink.cmp", + }, + opts = { + llm = { + provider = "copilot", + model = "claude-3-sonnet-20240229", + }, }, }, } diff --git a/dot_config/nvim/lua/plugins/lsp/blink.lua b/dot_config/nvim/lua/plugins/lsp/blink.lua new file mode 100644 index 00000000..2ad95460 --- /dev/null +++ b/dot_config/nvim/lua/plugins/lsp/blink.lua @@ -0,0 +1,18 @@ +return { + { + "saghen/blink.cmp", + lazy = false, + version = "*", + opts = { + keymap = { + preset = "enter", + [""] = { "select_prev", "fallback" }, + [""] = { "select_next", "fallback" }, + }, + cmdline = { sources = { "cmdline" } }, + sources = { + default = { "lsp", "path", "buffer", "codecompanion" }, + }, + }, + }, +} diff --git a/dot_config/nvim/lua/plugins/lsp/nvim-treesitter.lua b/dot_config/nvim/lua/plugins/lsp/nvim-treesitter.lua deleted file mode 100644 index 1a04d6b2..00000000 --- a/dot_config/nvim/lua/plugins/lsp/nvim-treesitter.lua +++ /dev/null @@ -1,98 +0,0 @@ -return { - { - "nvim-treesitter/nvim-treesitter", - dependencies = { "RRethy/nvim-treesitter-endwise" }, - endwise = { enable = true }, - auto_install = true, - - config = function(_, opts) - require("nvim-treesitter.configs").setup(opts) - vim.treesitter.language.register("lua", "lua.tmpl") - vim.treesitter.language.register("toml", "toml.tmpl") - end, - - opts = function(_, opts) - vim.list_extend(opts.ensure_installed, { - "bash", - - "cmake", - "comment", - "csv", - - "diff", - "dockerfile", - "dot", - - "embedded_template", - "elixir", - - "git_config", - "gitignore", - "gleam", - "gpg", - "graphql", - "html", - - "html", - - "java", - "javascript", - "json", - "jq", - - "kotlin", - - "llvm", - - "lua", - "luadoc", - "latex", - - "markdown", - "markdown_inline", - - "nu", - "nix", - "nginx", - "norg", - - "python", - "proto", - - "query", - - "readline", - "r", - "regex", - "rust", - "ruby", - - "ssh_config", - "swift", - "svelte", - "superhtml", - "ssh_config", - "sql", - "scss", - "scala", - - "toml", - "tsx", - "typescript", - "tmux", - "typst", - "terraform", - "templ", - - "vim", - "vimdoc", - - "xml", - - "yaml", - - "zig", - }) - end, - }, -} diff --git a/dot_config/nvim/lua/plugins/lsp/nvim-treesitter.lua.tmpl b/dot_config/nvim/lua/plugins/lsp/nvim-treesitter.lua.tmpl new file mode 100644 index 00000000..edc8d256 --- /dev/null +++ b/dot_config/nvim/lua/plugins/lsp/nvim-treesitter.lua.tmpl @@ -0,0 +1,23 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + dependencies = { "RRethy/nvim-treesitter-endwise" }, + endwise = { enable = true }, + auto_install = true, + + config = function(_, opts) + require("nvim-treesitter.configs").setup(opts) + vim.treesitter.language.register("lua", "lua.tmpl") + vim.treesitter.language.register("toml", "toml.tmpl") + end, + + opts = function(_, opts) + vim.list_extend(opts.ensure_installed, { + {{- range $package := .treesitter.ensure_installed -}} + "{{.}}", + + {{- end -}} + }) + end, + }, +} diff --git a/dot_config/nvim/lua/plugins/snacks.lua b/dot_config/nvim/lua/plugins/snacks.lua index b524e374..696674d9 100644 --- a/dot_config/nvim/lua/plugins/snacks.lua +++ b/dot_config/nvim/lua/plugins/snacks.lua @@ -11,6 +11,20 @@ return { indent = { enabled = true }, input = { enabled = true }, notifier = { enabled = true }, + picker = { + enabled = true, + exclude = { -- add folder names here to exclude + ".git", + "node_modules", + }, + sources = { + explorer = { + auto_close = false, + hidden = true, + ignored = true, + }, + }, + }, quickfile = { enabled = true }, scope = { enabled = true }, scroll = { enabled = false }, diff --git a/dot_config/obsidian/README.md b/dot_config/obsidian/README.md index 1e4a42f3..a147873e 100644 --- a/dot_config/obsidian/README.md +++ b/dot_config/obsidian/README.md @@ -1,6 +1,7 @@ # Obsidian Configuration -A personalized Obsidian setup for knowledge management and note-taking, integrated with Neovim for enhanced editing capabilities. +A personalized Obsidian setup for knowledge management and note-taking, +integrated with Neovim for enhanced editing capabilities. ## Features @@ -22,6 +23,7 @@ A personalized Obsidian setup for knowledge management and note-taking, integrat ## Configuration Structure The configuration is managed through Chezmoi: + - `.chezmoiexternal.toml.tmpl` - External template configuration - Vault-specific configurations - Plugin settings @@ -29,12 +31,14 @@ The configuration is managed through Chezmoi: ## Installation 1. Clone this configuration using Chezmoi: - ```bash + + ```zsh chezmoi init --apply ``` 2. Install Obsidian: - ```bash + + ```zsh brew install --cask obsidian ``` @@ -43,17 +47,21 @@ The configuration is managed through Chezmoi: ## Customization ### Vault Management + - Multiple vault support - Custom vault organization - Neovim integration for editing ### Plugin Settings + Configured plugins include: + - Core plugins - Community plugins - Custom settings ### Theme and Styling + - Custom CSS snippets - Theme settings - Layout preferences @@ -61,6 +69,7 @@ Configured plugins include: ## Neovim Integration The configuration includes Neovim integration for enhanced editing: + - Custom commands for vault access - Plugin support - Syntax highlighting @@ -74,4 +83,4 @@ The configuration includes Neovim integration for enhanced editing: ## Contributing -Feel free to submit issues and enhancement requests! \ No newline at end of file +Feel free to submit issues and enhancement requests! diff --git a/dot_config/tmux/README.md b/dot_config/tmux/README.md index d8e57942..de8ed146 100644 --- a/dot_config/tmux/README.md +++ b/dot_config/tmux/README.md @@ -1,6 +1,7 @@ # Tmux Configuration -A modern and functional Tmux configuration with Catppuccin theme integration, custom keybindings, and productivity features. +A modern and functional Tmux configuration with Catppuccin theme integration, +custom keybindings, and productivity features. ## Features @@ -18,6 +19,7 @@ A modern and functional Tmux configuration with Catppuccin theme integration, cu ## Configuration Structure The configuration is split into multiple files for better organization: + - `tmux.conf` - Main configuration file - `tmux.keybindings.conf` - Custom keybindings - `tmux.pomodoro.conf` - Pomodoro timer settings @@ -27,32 +29,40 @@ The configuration is split into multiple files for better organization: ## Installation 1. Clone this configuration using Chezmoi: - ```bash + + ```zsh chezmoi init --apply ``` 2. Ensure Tmux is installed: - ```bash + + ```zsh brew install tmux ``` ## Customization ### Theme + The configuration uses Catppuccin theme with: + - Transparent background support - Custom status line colors - Theme variables managed through Chezmoi ### Keybindings + Custom keybindings are organized in `tmux.keybindings.conf`: + - Window management - Pane splitting and navigation - Session management - Copy mode enhancements ### Pomodoro Timer + The Pomodoro timer configuration includes: + - Custom timer durations - Visual notifications - Status bar integration @@ -64,4 +74,4 @@ The Pomodoro timer configuration includes: ## Contributing -Feel free to submit issues and enhancement requests! \ No newline at end of file +Feel free to submit issues and enhancement requests! diff --git a/go.mod b/go.mod new file mode 100644 index 00000000..24c75156 --- /dev/null +++ b/go.mod @@ -0,0 +1,14 @@ +module github.com/thatguyinabeanie/dotfiles + +go 1.24 + +require ( + github.com/alecthomas/assert/v2 v2.5.0 + github.com/twpayne/go-vfs/v5 v5.0.0 +) + +require ( + github.com/alecthomas/repr v0.3.0 // indirect + github.com/hexops/gotextdiff v1.0.3 // indirect + golang.org/x/sys v0.16.0 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 00000000..ecd8df2e --- /dev/null +++ b/go.sum @@ -0,0 +1,10 @@ +github.com/alecthomas/assert/v2 v2.5.0 h1:OJKYg53BQx06/bMRBSPDCO49CbCDNiUQXwdoNrt6x5w= +github.com/alecthomas/assert/v2 v2.5.0/go.mod h1:fw5suVxB+wfYJ3291t0hRTqtGzFYdSwstnRQdaQx2DM= +github.com/alecthomas/repr v0.3.0 h1:NeYzUPfjjlqHY4KtzgKJiWd6sVq2eNUPTi34PiFGjY8= +github.com/alecthomas/repr v0.3.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= +github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= +github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= +github.com/twpayne/go-vfs/v5 v5.0.0 h1:aEYr6zB1X+rkM1rc0qGRU6FNlULLRlltMH6iRKMKoC4= +github.com/twpayne/go-vfs/v5 v5.0.0/go.mod h1:x4tZII+nP25/KlZ2lTPXxnTiS1ZSE10yNJ/mGiBoR8s= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= diff --git a/install.sh b/install.sh index 74f0c896..338ebfcd 100755 --- a/install.sh +++ b/install.sh @@ -1,25 +1,29 @@ #!/bin/sh +# This script must be POSIX-compliant. # -e: exit on error # -u: exit on unset variables set -eu -if ! chezmoi="$(command -v chezmoi)"; then - bin_dir="${HOME}/.local/bin" - chezmoi="${bin_dir}/chezmoi" - echo "Installing chezmoi to '${chezmoi}'" >&2 - if command -v curl >/dev/null; then - chezmoi_install_script="$(curl -fsSL https://chezmoi.io/get)" - elif command -v wget >/dev/null; then - chezmoi_install_script="$(wget -qO- https://chezmoi.io/get)" - else - echo "To install chezmoi, you must have curl or wget installed." >&2 - exit 1 - fi - sh -c "${chezmoi_install_script}" -- -b "${bin_dir}" - unset chezmoi_install_script bin_dir +# Define common variables +bin_dir="${HOME}/.local/bin" +target_chezmoi="${bin_dir}/chezmoi" + +# Check for download tools and get installation script +if command -v curl >/dev/null; then + chezmoi_install_script="$(curl -fsSL https://chezmoi.io/get)" +elif command -v wget >/dev/null; then + chezmoi_install_script="$(wget -qO- https://chezmoi.io/get)" +else + echo "To install chezmoi, you must have curl or wget installed." >&2 + exit 1 fi +# Install or update chezmoi +echo "Installing/updating chezmoi to '${target_chezmoi}'" >&2 +sh -c "${chezmoi_install_script}" -- -b "${bin_dir}" +unset chezmoi_install_script + # POSIX way to get script's dir: https://stackoverflow.com/a/29834779/12156188 script_dir="$(cd -P -- "$(dirname -- "$(command -v -- "$0")")" && pwd -P)" @@ -27,4 +31,4 @@ set -- init --apply --source="${script_dir}" echo "Running 'chezmoi $*'" >&2 # exec: replace current process with chezmoi -exec "$chezmoi" "$@" +exec "${target_chezmoi}" "$@" diff --git a/tests/helpers/testutils.go b/tests/helpers/testutils.go new file mode 100644 index 00000000..e208a2d2 --- /dev/null +++ b/tests/helpers/testutils.go @@ -0,0 +1,51 @@ +package tests_helpers + +import ( + "os" + "path/filepath" + "testing" +) + +// TestConfig represents the test configuration +type TestConfig struct { + HomeDir string + ConfigDir string + WorkEnv bool + GitUsername string +} + +// NewTestConfig creates a new test configuration +func NewTestConfig(t *testing.T) *TestConfig { + t.Helper() + + tmpDir := t.TempDir() + homeDir := filepath.Join(tmpDir, "home") + configDir := filepath.Join(homeDir, ".config") + + // Create necessary directories + dirs := []string{ + homeDir, + configDir, + filepath.Join(configDir, "nvim"), + filepath.Join(configDir, "nushell"), + filepath.Join(configDir, "obsidian"), + } + + for _, dir := range dirs { + if err := os.MkdirAll(dir, 0755); err != nil { + t.Fatalf("Failed to create directory %s: %v", dir, err) + } + } + + return &TestConfig{ + HomeDir: homeDir, + ConfigDir: configDir, + WorkEnv: false, + GitUsername: "thatguyinabeanie", + } +} + +// SetWorkEnv sets the work environment flag +func (tc *TestConfig) SetWorkEnv(workEnv bool) { + tc.WorkEnv = workEnv +} diff --git a/tests/integration/fs_test.go b/tests/integration/fs_test.go new file mode 100644 index 00000000..15f06294 --- /dev/null +++ b/tests/integration/fs_test.go @@ -0,0 +1,45 @@ +package tests_integration + +import ( + "testing" + + "github.com/twpayne/go-vfs/v5/vfst" +) + +func TestFileSystemStructure(t *testing.T) { + fs, cleanup, err := vfst.NewTestFS(map[string]interface{}{ + "/home/user/.config": map[string]interface{}{ + "nvim": &vfst.Dir{Perm: 0755}, + "nushell": &vfst.Dir{Perm: 0755}, + "obsidian": &vfst.Dir{Perm: 0755}, + "tmux": &vfst.Dir{Perm: 0755}, + }, + }) + if err != nil { + t.Fatal(err) + } + defer cleanup() + + tests := []struct { + name string + path string + wantType string + }{ + {"Neovim Config Dir", "/home/user/.config/nvim", "dir"}, + {"Nushell Config Dir", "/home/user/.config/nushell", "dir"}, + {"Obsidian Config Dir", "/home/user/.config/obsidian", "dir"}, + {"Tmux Config Dir", "/home/user/.config/tmux", "dir"}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + info, err := fs.Stat(tt.path) + if err != nil { + t.Errorf("Failed to stat %s: %v", tt.path, err) + } + if got := info.IsDir(); got != (tt.wantType == "dir") { + t.Errorf("Wrong type for %s: got %v, want %s", tt.path, got, tt.wantType) + } + }) + } +} diff --git a/tests/integration/scripts/install.txtar b/tests/integration/scripts/install.txtar new file mode 100644 index 00000000..d72aab05 --- /dev/null +++ b/tests/integration/scripts/install.txtar @@ -0,0 +1,19 @@ +# Test basic installation +exec chezmoi init --apply +stdout 'Installing chezmoi' +! stderr . + +# Test configuration files +exists $HOME/.config/nvim +exists $HOME/.config/nushell +exists $HOME/.config/obsidian +exists $HOME/.config/tmux + +# Test Homebrew packages installation +[darwin] exec brew list +[darwin] stdout 'nvim' +[darwin] stdout 'nushell' + +# Test Git repositories +exists $HOME/source/DOOM-fire-zig +exists $HOME/.config/obsidian/obsidian-vault \ No newline at end of file diff --git a/tests/main_test.go b/tests/main_test.go new file mode 100644 index 00000000..9ec1f81f --- /dev/null +++ b/tests/main_test.go @@ -0,0 +1,49 @@ +package tests + +import ( + "os" + "path/filepath" + "testing" +) + +func TestMain(m *testing.M) { + // Change to the root directory of the project if needed + if _, err := os.Stat("dot_config"); os.IsNotExist(err) { + // Try to find the root directory + dirs := []string{".", "..", "../.."} + for _, dir := range dirs { + if _, err := os.Stat(filepath.Join(dir, "dot_config")); err == nil { + // Do this: + if err := os.Chdir(dir); err != nil { + os.Exit(1) + } + break + } + } + } + code := m.Run() + os.Exit(code) +} + +func TestConfigDirectoryStructure(t *testing.T) { + // First verify we're in the right directory + if _, err := os.Stat("dot_config"); os.IsNotExist(err) { + t.Fatal("Test must be run from the project root directory containing dot_config") + } + + configDirs := []string{ + "nvim", + "nushell", + "obsidian", + "tmux", + "mise", + "git", + } + + for _, dir := range configDirs { + path := filepath.Join("dot_config", dir) + if _, err := os.Stat(path); os.IsNotExist(err) { + t.Errorf("Expected config directory %s to exist", path) + } + } +} diff --git a/tests/unit/config_test.go b/tests/unit/config_test.go new file mode 100644 index 00000000..15da7053 --- /dev/null +++ b/tests/unit/config_test.go @@ -0,0 +1,96 @@ +package tests_unit + +import ( + "testing" + + "github.com/alecthomas/assert/v2" +) + +func TestChezmoiConfig(t *testing.T) { + t.Run("GitRepos Configuration", func(t *testing.T) { + t.Run("Obsidian Repos", testObsidianRepos) + t.Run("Work Repos", testWorkRepos) + t.Run("Private Repos", testPrivateRepos) + }) + + t.Run("Homebrew Configuration", func(t *testing.T) { + t.Run("Work Packages", testWorkBrewPackages) + t.Run("Personal Packages", testPersonalBrewPackages) + t.Run("Shared Dependencies", testSharedDependencies) + }) +} + +func testObsidianRepos(t *testing.T) { + repos := []string{ + "obsidian-vault", + "obsidian-vault-work", + "bramses/bramses-highly-opinionated-vault-2023", + } + + for _, repo := range repos { + assert.NotEqual(t, repo, "") + } +} + +func testWorkRepos(t *testing.T) { + repos := []string{ + "console", + "popsicle", + } + + for _, repo := range repos { + assert.NotEqual(t, repo, "") + } +} + +func testPrivateRepos(t *testing.T) { + repos := []string{ + "personal-notes", + } + + for _, repo := range repos { + assert.NotEqual(t, repo, "") + assert.Equal(t, "personal-notes", repos[0]) + } +} + +func testWorkBrewPackages(t *testing.T) { + packages := []string{ + "argo", + "awscli", + "circleci", + "kind", + "k9s", + } + + for _, pkg := range packages { + assert.NotEqual(t, pkg, "") + } +} + +func testPersonalBrewPackages(t *testing.T) { + casks := []string{ + "1password", + "1password-cli", + "blender", + "darktable", + "discord", + } + + for _, cask := range casks { + assert.NotEqual(t, cask, "") + } +} + +func testSharedDependencies(t *testing.T) { + taps := []string{ + "adoptopenjdk/openjdk", + "charmbracelet/tap", + "hashicorp/tap", + "homebrew/autoupdate", + } + + for _, tap := range taps { + assert.NotEqual(t, tap, "") + } +}