mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-08 01:50:42 +00:00
* fix(ci): replace broad permissions with specific scopes in workflows
Replace read-all/write-all with minimum required permission scopes
across all GitHub Actions workflows to follow the principle of least
privilege (SonarCloud rule githubactions:S8234).
* fix(shell): use [[ instead of [ for conditional tests
Replace single brackets with double brackets in bash conditional
expressions across 14 files (28 changes). All scripts use bash
shebangs so [[ is safe everywhere (SonarCloud rule shelldre:S7688).
* fix(shell): add explicit return statements to functions
Add return 0 as the last statement in ~46 shell functions across
17 files that previously relied on implicit return codes
(SonarCloud rule shelldre:S7682).
* fix(shell): assign positional parameters to local variables
Replace direct $1/$2/$3 usage with named local variables in _log(),
msg(), msg_err(), msg_done(), msg_run(), msg_ok(), and array_diff()
(SonarCloud rule shelldre:S7679).
* fix(python): replace dict() constructor with literal
Use {} instead of dict() for empty dictionary initialization
(SonarCloud rule python:S7498).
* fix(shell): fix husky shebang and tolerate npm outdated exit code
* docs(shell): add function docstring comments
* fix(shell): fix heredoc indentation in x-sonarcloud
* feat(python): add ruff linter and formatter configuration
* fix(ci): align megalinter config with biome, ruff, and shfmt settings
* fix(ci): disable black and yaml-prettier in megalinter config
* chore(ci): update ruff-pre-commit to v0.15.0 and fix hook name
* fix(scripts): check for .git dir before skipping clone in install-fonts
* fix(shell): address code review issues in scripts and shared.sh
- Guard wezterm show-keys failure in create-wezterm-keymaps.sh
- Stop masking git failures with return 0 in install-cheat-purebashbible.sh
- Add missing shared.sh source in install-xcode-cli-tools.sh
- Replace exit 1 with return 1 in sourced shared.sh
* fix(scripts): address code review and security findings
- Guard wezterm show-keys failure in create-wezterm-keymaps.sh
- Stop masking git failures with return 0 in install-cheat-purebashbible.sh
- Add missing shared.sh source in install-xcode-cli-tools.sh
- Replace exit 1 with return 1 in sourced shared.sh
- Remove shell=True subprocess calls in x-git-largest-files.py
* style(shell): apply shfmt formatting and add args to pre-commit hook
* fix(python): suppress bandit false positives in x-git-largest-files
* fix(python): add nosemgrep suppression for check_output call
* feat(format): add prettier for YAML formatting
Install prettier, add .prettierrc.json config (200-char width, 2-space
indent, LF endings), .prettierignore, yarn scripts (lint:prettier,
fix:prettier, format:yaml), and pre-commit hook scoped to YAML files.
* style(yaml): apply prettier formatting
* fix(scripts): address remaining code review findings
- Python: use list comprehension to filter empty strings instead of
slicing off the last element
- create-wezterm-keymaps: write to temp file and mv for atomic updates
- install-xcode-cli-tools: fix shellcheck source directive path
* fix(python): sort imports alphabetically in x-git-largest-files
* fix(lint): disable PYTHON_ISORT in MegaLinter, ruff handles it
* chore(git): add __pycache__ to gitignore
* fix(python): rename ambiguous variable l to line (E741)
* style: remove trailing whitespace and blank lines
* style(fzf): apply shfmt formatting
* style(shell): apply shfmt formatting
* docs(plans): add design documents
* style(docs): add language specifier to fenced code block
* feat(lint): add markdown-table-formatter to dev tooling
Add markdown-table-formatter as a dev dependency with yarn scripts
(lint:md-table, fix:md-table) and a local pre-commit hook to
automatically format markdown tables on commit.
124 lines
4.3 KiB
Markdown
124 lines
4.3 KiB
Markdown
# CLAUDE.md
|
|
|
|
This file provides guidance to Claude Code (claude.ai/code)
|
|
when working with code in this repository.
|
|
|
|
## Repository Overview
|
|
|
|
Personal dotfiles repository for Ismo Vuorinen.
|
|
Uses **Dotbot** (not GNU Stow) to symlink configuration files into place.
|
|
The directory layout follows the XDG Base Directory Specification.
|
|
|
|
## Directory Layout and Linking
|
|
|
|
| Source | Destination | Notes |
|
|
|---------------------|-------------------|-------------------------------------------|
|
|
| `base/*` | `~/.*` | Home-level dotfiles (`.` added by Dotbot) |
|
|
| `config/*` | `~/.config/` | Application configurations |
|
|
| `local/bin/*` | `~/.local/bin/` | Helper scripts and utilities |
|
|
| `local/share/*` | `~/.local/share/` | Data files |
|
|
| `local/man/**` | `~/.local/man/` | Manual pages |
|
|
| `ssh/*` | `~/.ssh/` | SSH configuration (mode 0600) |
|
|
| `hosts/<hostname>/` | Overlays | Host-specific overrides |
|
|
|
|
Installation: `./install` runs Dotbot with `install.conf.yaml`,
|
|
then applies `hosts/<hostname>/install.conf.yaml` if it exists.
|
|
|
|
## Commands
|
|
|
|
```bash
|
|
# Install dependencies (required before lint/test)
|
|
yarn install
|
|
|
|
# Linting
|
|
yarn lint # Run biome + prettier + editorconfig-checker
|
|
yarn lint:biome # Biome only
|
|
yarn lint:ec # EditorConfig checker only
|
|
|
|
# Formatting
|
|
yarn fix:biome # Autofix with biome (JS/TS/JSON/MD)
|
|
yarn fix:prettier # Autofix with prettier (YAML)
|
|
yarn format # Format with biome
|
|
yarn format:yaml # Format YAML files with prettier
|
|
|
|
# Testing (Bats - Bash Automated Testing System)
|
|
yarn test # Run all tests in tests/
|
|
# Run a single test file:
|
|
./node_modules/.bin/bats tests/dfm.bats
|
|
|
|
# Shell linting
|
|
shellcheck <script> # Lint shell scripts
|
|
```
|
|
|
|
## Pre-commit Hooks
|
|
|
|
Configured in `.pre-commit-config.yaml`: shellcheck, shfmt, biome,
|
|
yamllint, prettier, actionlint, stylua, fish_syntax/fish_indent.
|
|
Run `pre-commit run --all-files` to check everything.
|
|
|
|
## Commit Convention
|
|
|
|
Semantic Commit messages: `type(scope): summary`
|
|
(e.g., `fix(tmux): correct prefix binding`).
|
|
Enforced by commitlint extending `@ivuorinen/commitlint-config`.
|
|
|
|
## Architecture
|
|
|
|
### Shell Configuration Chain
|
|
|
|
Both `base/bashrc` and `base/zshrc` source `config/shared.sh`,
|
|
which loads:
|
|
- `config/exports` — environment variables, XDG dirs, PATH
|
|
- `config/alias` — shell aliases
|
|
|
|
Zsh additionally uses **antidote** (in `tools/antidote/`)
|
|
for plugin management and **oh-my-posh** for the prompt.
|
|
|
|
### dfm — Dotfiles Manager
|
|
|
|
`local/bin/dfm` is the main management script. Key commands:
|
|
- `dfm install all` — install everything (called during `./install`)
|
|
- `dfm brew install` / `dfm brew update` — Homebrew management
|
|
- `dfm docs all` — regenerate documentation under `docs/`
|
|
|
|
### Submodules
|
|
|
|
External dependencies are git submodules (Dotbot, plugins,
|
|
tmux plugins, cheatsheets, antidote).
|
|
Managed by `add-submodules.sh`. All set to `ignore = dirty`.
|
|
Updated automatically via GitHub Actions on a schedule.
|
|
|
|
### Host-specific Configs
|
|
|
|
Machine-specific overrides live in `hosts/<hostname>/`
|
|
with their own `base/`, `config/`, and `install.conf.yaml`.
|
|
These are layered on top of the global config during installation.
|
|
|
|
## Code Style
|
|
|
|
- **EditorConfig**: 2-space indent, UTF-8, LF line endings.
|
|
See `.editorconfig` for per-filetype overrides
|
|
(4-space for PHP/fish, tabs for git config).
|
|
- **Shell scripts**: Must have a shebang or
|
|
`# shellcheck shell=bash` directive.
|
|
Follow shfmt settings in `.editorconfig`
|
|
(2-space indent, `binary_next_line`,
|
|
`switch_case_indent`, `space_redirects`, `function_next_line`).
|
|
- **Lua** (neovim config): Formatted with stylua (`stylua.toml`),
|
|
90-char line length.
|
|
- **JSON/JS/TS/Markdown**: Formatted with Biome (`biome.json`),
|
|
80-char width.
|
|
- **YAML**: Formatted with Prettier (`.prettierrc.json`),
|
|
validated with yamllint (`.yamllint.yml`).
|
|
|
|
## ShellCheck Disabled Rules
|
|
|
|
Defined in `.shellcheckrc`:
|
|
SC2039 (POSIX `local`), SC2166 (`-o` in test),
|
|
SC2154 (unassigned variables), SC1091 (source following),
|
|
SC2174 (mkdir -p -m), SC2016 (single-quote expressions).
|
|
|
|
## Package Manager
|
|
|
|
Yarn (v4.12.0) is the package manager. Do not use npm.
|