diff --git a/Brewfile b/Brewfile new file mode 100644 index 0000000..e5fc896 --- /dev/null +++ b/Brewfile @@ -0,0 +1,28 @@ +# Brewfile - AI & Agent-Optimized macOS Setup +# Focused entirely on high-performance tools that LLM agents use to find, read, edit, format, and run code. +# Install all tools with: brew bundle --no-lock + +# --- Homebrew Taps --- +tap "homebrew/bundle" + +# --- Essential VCS --- +brew "git" +brew "gh" # GitHub CLI for agent-initiated PRs and issue management + +# --- High-Performance Agent Search & Filter Utilities --- +brew "ripgrep" # 'rg' is the primary tool agents use for fast workspace-wide code searches +brew "fd" # 'fd' is a lightning-fast tool agents use to locate files +brew "jq" # JSON parser essential for agent tool calling and structured output parsing +brew "fzf" # Fuzzy finder + +# --- Modern, Fast Runtime Managers for Agents --- +# Instead of slow, shell-heavy runtimes (like pyenv/nvm), we focus on modern, lightweight tools. +brew "uv" # Lightning-fast, single-binary Rust tool for Python installs, environments, and runs (perfect for agents) + +# --- Agent Quality & Formatting Tools --- +# These ensure that agent-generated shell/code files are automatically formatted and verified. +brew "shfmt" # Shell script formatter (agents use this to auto-format their code) +brew "shellcheck" # Shell script static analyzer (agents use this to auto-validate shell commands) + +# --- AI Token & Output Compression --- +brew "rtk" # Rust Token Killer - cuts up to 90% of bash output agent reads diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..51ab7ac --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,28 @@ +# CLAUDE.md - Rules for Claude Code and AI Assistants + +This file contains guides and requirements for AI assistants (like Claude Code) working on this repository. + +## Commands + +### Installer and Git Setup +- Run installer: `./install.sh` +- Set up personal Git config: `./git-config-setup.sh` + +### Diagnostics & Validation +- Run ShellCheck: `shellcheck install.sh git-config-setup.sh` (if available) +- Format shell scripts: `shfmt -i 2 -ci -bn -sr -w install.sh git-config-setup.sh` (if available) + +## Coding Standards + +### Shell Scripts +- Use Bash for scripts (`#!/usr/bin/env bash`). +- Always use `set -euo pipefail` to ensure robust error handling. +- Format all shell files using `shfmt` with flags: `shfmt -i 2 -ci -bn -sr`. +- Resolve all ShellCheck warnings where possible, or add inline exceptions (e.g. `# shellcheck disable=SCxxxx`). +- Provide cross-platform compatibility where possible (macOS/Linux). + +### Code Style & Workflow +- **Commit Titles**: Follow Conventional Commits: `type(scope): message`. +- **Branch Strategy**: Branch names should be structured as `type/scope/short-description` (e.g., `feat/rtk/add-token-killer`). +- **Never Push to main**: Always develop on branch and submit PR. +- **Safety**: Provide a dry-run or reversible backups for installer actions. diff --git a/README.md b/README.md index b626e60..f07a05f 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,17 @@ [![Yamllint](https://github.com/benrozsa/dotfiles/actions/workflows/yamllint.yml/badge.svg)](https://github.com/benrozsa/dotfiles/actions/workflows/yamllint.yml) [![Actionlint](https://github.com/benrozsa/dotfiles/actions/workflows/actionlint.yml/badge.svg)](https://github.com/benrozsa/dotfiles/actions/workflows/actionlint.yml) -Personal configuration files for macOS **and** Linux (tested on Fedora Workstation). -Provides a simple, repeatable setup for shell, Git, Vim, and VS Code. +Personal configuration files for macOS **and** Linux. +Modernized for the **2026 Post-AI era**—designed to streamline setups where you let AI agents do the coding. --- ## Features +- **Post-AI Optimization** + - **RTK (Rust Token Killer)** integration to reduce command-line output bloat, cutting LLM/Agent token consumption by up to 90%! + - `Brewfile` for standardized macOS package setup, instantly bootstrapping essential development & AI CLI utilities. + - `CLAUDE.md` and custom instructions (`AGENTS.md`) detailing workspace rules and commands specifically for AI coding agents (e.g., Claude Code, Kilo). - **Shell Configuration** - `.zshenv` for PATH/env — loaded by every shell, including non-interactive subshells (AI agents, scripts) - `.zshrc` for interactive setup — framework-free; plugins cloned directly into `~/.zsh/plugins` @@ -25,19 +29,21 @@ Provides a simple, repeatable setup for shell, Git, Vim, and VS Code. - global ignore file (`.DS_Store` on macOS, space for Linux ignores too) - cross‑platform credential helper (macOS: `osxkeychain`; Linux: `libsecret` if available) -- **Editor Configuration** +- **Editor & MCP Configuration** - `.vimrc` — minimal, no plugins: line numbers, search, indentation, system clipboard, persistent undo, `jk`→Esc - `.vscode/settings.json` for consistent VS Code behavior - `.vscode/extensions.json` listing recommended extensions - - `mcp.json` for workspace/project metadata + - `mcp.json` for workspace/project metadata & Model Context Protocol server configuration - **Setup Script** - `install.sh`: + - On macOS, automatically runs `brew bundle` with the provided `Brewfile` to install all utilities. - Safely symlinks dotfiles into your home directory - Backs up existing files as `.bak` before linking - Ensures Zsh plugins are installed/updated - Runs personal Git setup if `git-config-setup.sh` is present - Detects platform for VS Code settings path (macOS vs Linux) + - Sets up global auto-rewrite hooks for **RTK** to automatically optimize agent sessions. --- @@ -46,6 +52,7 @@ Provides a simple, repeatable setup for shell, Git, Vim, and VS Code. - **macOS** or **Fedora/Linux** - Git - Vim +- Homebrew (recommended for macOS auto-provisioning) - [VS Code](https://code.visualstudio.com/) (with CLI `code` available in `$PATH`) - Optional tools: - shfmt (shell formatter) for on-save formatting in VS Code — install via `brew install shfmt` (macOS) or `sudo dnf install shfmt` (Fedora) diff --git a/install.sh b/install.sh index d4fd369..60c762f 100755 --- a/install.sh +++ b/install.sh @@ -41,13 +41,29 @@ link() { # --------- Paths --------- export DOTFILES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)" +# Detect OS +OS_TYPE="$(uname -s)" + # Detect VS Code user settings dir -case "$(uname -s)" in +case "$OS_TYPE" in Darwin) CODE_USER_DIR="$HOME/Library/Application Support/Code/User" ;; Linux) CODE_USER_DIR="$HOME/.config/Code/User" ;; *) CODE_USER_DIR="$HOME/.config/Code/User" ;; esac +# --------- Homebrew Bundle (macOS only) --------- +if [[ "$OS_TYPE" == "Darwin" ]]; then + if have brew; then + if [[ -f "$DOTFILES_DIR/Brewfile" ]]; then + info "Found Brewfile. Running brew bundle to install/update packages..." + brew bundle --file="$DOTFILES_DIR/Brewfile" --no-lock || warn "Some Homebrew bundle installs failed or skipped." + ok "Homebrew bundle applied." + fi + else + warn "Homebrew is not installed. Skip installing Brewfile." + fi +fi + # --------- Dotfiles --------- info "Symlinking dotfiles to home directory..." link "$DOTFILES_DIR/.zshrc" "$HOME/.zshrc" @@ -117,6 +133,16 @@ for entry in "${plugins[@]}"; do ok "$name ready" done +# --------- RTK (Rust Token Killer) Setup --------- +if have rtk; then + info "RTK is installed. Initializing global hook to reduce AI agent token usage..." + # Run rtk init globally in non-interactive / auto-patch mode if possible + rtk init -g --auto-patch || rtk init -g || warn "RTK initialization finished with warnings or skipped." + ok "RTK auto-rewrite hook set up." +else + info "RTK not found; skipping hook setup. Install with: brew install rtk" +fi + ok "🎉 Setup complete." info "Open this repo in VS Code → Extensions → 'Install All' (from .vscode/extensions.json)."