| 
 | 1 | +# CLAUDE.md  | 
 | 2 | + | 
 | 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.  | 
 | 4 | + | 
 | 5 | +## Project Overview  | 
 | 6 | + | 
 | 7 | +Bash-it is a collection of community Bash commands and scripts for Bash 3.2+, providing a framework for aliases, themes, plugins, and completions. It's structured as a modular system where components can be individually enabled or disabled.  | 
 | 8 | + | 
 | 9 | +## Architecture  | 
 | 10 | + | 
 | 11 | +### Core Components  | 
 | 12 | + | 
 | 13 | +- **bash_it.sh**: Main entry point that initializes the framework  | 
 | 14 | +- **lib/**: Core libraries providing utilities, logging, helpers, and appearance functions  | 
 | 15 | +- **scripts/reloader.bash**: Component loader that sources enabled components  | 
 | 16 | +- **install.sh**: Installation script with interactive and silent modes  | 
 | 17 | +- **enabled/**: Symlinks to active components from available/ directories  | 
 | 18 | + | 
 | 19 | +### Component Types  | 
 | 20 | + | 
 | 21 | +1. **Aliases** (`aliases/available/`): Command shortcuts and convenience functions  | 
 | 22 | +2. **Plugins** (`plugins/available/`): Extended functionality and integrations  | 
 | 23 | +3. **Completions** (`completion/available/`): Tab completion definitions  | 
 | 24 | +4. **Themes** (`themes/`): Prompt customizations and visual styles  | 
 | 25 | + | 
 | 26 | +### Loading Order  | 
 | 27 | + | 
 | 28 | +1. Libraries (except appearance)  | 
 | 29 | +2. Global enabled directory  | 
 | 30 | +3. Enabled aliases, plugins, completions  | 
 | 31 | +4. Theme files (if BASH_IT_THEME is set)  | 
 | 32 | +5. Custom files from BASH_IT_CUSTOM directory  | 
 | 33 | + | 
 | 34 | +## Development Commands  | 
 | 35 | + | 
 | 36 | +### Testing  | 
 | 37 | +```bash  | 
 | 38 | +# Run all tests using BATS (Bash Automated Testing System)  | 
 | 39 | +test/run  | 
 | 40 | + | 
 | 41 | +# Run specific test suites  | 
 | 42 | +test/run test/bash_it test/completion test/plugins  | 
 | 43 | + | 
 | 44 | +# Tests require git submodules to be initialized  | 
 | 45 | +git submodule init && git submodule update  | 
 | 46 | +```  | 
 | 47 | + | 
 | 48 | +### Linting and Code Quality  | 
 | 49 | + | 
 | 50 | +The project uses a gradual pre-commit system implementation via `clean_files.txt` allow-list:  | 
 | 51 | + | 
 | 52 | +```bash  | 
 | 53 | +# Run pre-commit hooks only on allow-listed clean files  | 
 | 54 | +./lint_clean_files.sh  | 
 | 55 | + | 
 | 56 | +# Run pre-commit hooks on all files (for testing new coverage)  | 
 | 57 | +pre-commit run --all-files  | 
 | 58 | + | 
 | 59 | +# Manual shellcheck on bash files  | 
 | 60 | +shellcheck **/*.bash  | 
 | 61 | + | 
 | 62 | +# Format shell scripts  | 
 | 63 | +shfmt -w **/*.bash  | 
 | 64 | +```  | 
 | 65 | + | 
 | 66 | +**Gradual Linting System**:  | 
 | 67 | +- `clean_files.txt`: Allow-list of files/directories that pass all linting rules  | 
 | 68 | +- `lint_clean_files.sh`: Runs pre-commit hooks only on allow-listed files  | 
 | 69 | +- When modifying files NOT in `clean_files.txt`, ensure they pass linting before adding them to the allow-list  | 
 | 70 | +- Before creating a PR, add newly cleaned files to `clean_files.txt` to expand coverage  | 
 | 71 | +- This system allows gradual improvement of code quality across the large codebase  | 
 | 72 | + | 
 | 73 | +**Vendor Directory Policy**:  | 
 | 74 | +- Files in `vendor/` are treated as immutable external dependencies  | 
 | 75 | +- Pre-commit hooks exclude vendor files via `.pre-commit-config.yaml` global exclude pattern  | 
 | 76 | +- `clean_files.txt` does not include vendor shell scripts, only `.gitattributes`  | 
 | 77 | +- CI and local linting will skip vendor files entirely  | 
 | 78 | + | 
 | 79 | +### Component Management  | 
 | 80 | +```bash  | 
 | 81 | +# Enable/disable components  | 
 | 82 | +bash-it enable alias git  | 
 | 83 | +bash-it enable plugin history  | 
 | 84 | +bash-it enable completion docker  | 
 | 85 | + | 
 | 86 | +# Show available components  | 
 | 87 | +bash-it show aliases  | 
 | 88 | +bash-it show plugins    | 
 | 89 | +bash-it show completions  | 
 | 90 | + | 
 | 91 | +# Search components  | 
 | 92 | +bash-it search docker  | 
 | 93 | +```  | 
 | 94 | + | 
 | 95 | +## Key Configuration  | 
 | 96 | + | 
 | 97 | +### Environment Variables  | 
 | 98 | +- `BASH_IT`: Base directory path  | 
 | 99 | +- `BASH_IT_THEME`: Active theme name  | 
 | 100 | +- `BASH_IT_CUSTOM`: Custom components directory  | 
 | 101 | +- `BASH_IT_LOG_PREFIX`: Logging prefix for debug output  | 
 | 102 | + | 
 | 103 | +### File Structure Conventions  | 
 | 104 | +- Available components: `{type}/available/{name}.{type}.bash`  | 
 | 105 | +- Enabled components: `{type}/enabled/{name}.{type}.bash` (symlinks)  | 
 | 106 | +- Custom components: `custom/{name}.bash`  | 
 | 107 | +- Themes: `themes/{name}/`  | 
 | 108 | + | 
 | 109 | +## Development Guidelines  | 
 | 110 | + | 
 | 111 | +### Component Development  | 
 | 112 | +- Use composure metadata: `about`, `group`, `author`, `example`  | 
 | 113 | +- Follow naming convention: `{name}.{type}.bash`  | 
 | 114 | +- Test components before submitting  | 
 | 115 | +- Components should be modular and not conflict with others  | 
 | 116 | + | 
 | 117 | +### Testing Components  | 
 | 118 | +- Each component type has dedicated test files in `test/`  | 
 | 119 | +- Use BATS framework for shell script testing  | 
 | 120 | +- Test files follow pattern: `{component}.bats`  | 
 | 121 | + | 
 | 122 | +### Code Standards  | 
 | 123 | +- Use shellcheck for linting  | 
 | 124 | +- Follow existing code style in the repository  | 
 | 125 | +- Add appropriate metadata using composure functions  | 
 | 126 | +- Components should handle missing dependencies gracefully  | 
0 commit comments