Expand CLAUDE.md with detailed helper function reference, environment variables section, and commit conventions. Add .claude/rules/bash-style.md for bash coding standards.
1.8 KiB
1.8 KiB
Linux Workspace
Dotfiles & workstation automation for Linux, macOS, WSL. bashrc loads rc/*.sh (ordered by prefix)
and adds bin/ to PATH. $LWS points to repo root.
Directory Layout
rc/— Shell init files, loaded in0X-name.shorder. Per-tool env setup goes here.install/— Idempotent one-off installer scripts (run manually).bin/— Scripts auto-added to PATH. New CLI tools go here.scripts/— Setup scripts NOT on PATH (git-config, docker fixes, gnome config).conf/— Tool configs (vim, WireGuard, WSL).functions.sh— Core lib (see below).
Key Helpers (functions.sh)
can_run <cmd>— check if command is availableis_slow_init/is_fast_init— checkLWS_FASTmodeis_interactive_shell— true when[[ $- == *i* ]]is_wsl— detect WSL environmenttrue_false <val>— normalize1/true/yesto booleanprepend_path/append_path/prepend_path_try/append_path_try— safe PATH manipulationsource_try <file>— source file if it existssource_directory_sh <dir>— source all*.shin a directoryxlog <msg>— debug log (only in interactive +LWS_DEBUG)
Conventions
All new bash scripts should use:
#!/usr/bin/env bash
set -E -o errexit -o nounset -o pipefail
Before writing shell code, check functions.sh for existing helper functions and prefer them over raw commands.
RC files MUST guard slow tools and check availability:
if is_slow_init && can_run pyenv; then
# initialize pyenv
fi
Installers (install/*.sh) MUST be idempotent — check before installing.
Environment Variables
LWS_FAST=1— skips slow tools during shell initLWS_DEBUG=1— enables debug logging viaxlog
Commits
Do not add Co-Authored-By lines to commit messages.