CodeTree is a powerful Node.js tool that creates a detailed tree visualization of your codebase with smart configuration and customization options. It recursively scans your project directory, identifies code files, and generates a comprehensive analysis while respecting user-defined patterns and preferences.
- π Generates tree-style directory visualization
- π Includes line count and file size analysis
- π Shows file contents for supported code files
- β‘ Smart binary/text file detection
- π― Supports 40+ programming languages and config files
- π« Smart file and directory filtering
- π§ Highly configurable through JSON config files
- π Global and project-specific configurations
- π¨ Built-in extension groups for easy management
- π Debug mode for troubleshooting
- Node.js (v12.0.0 or higher)
- npm (v6.0.0 or higher)
- Git (for installation from source)
- Write permission for
/usr/local/bin
(or use sudo) - Bash shell (pre-installed on most systems)
# Clone the repository
git clone https://github.com/mimalef70/codetree.git
# Navigate to the codetree directory
cd codetree
# Make the installation script executable
chmod +x install.sh
# Run the installation script (might need sudo)
./install.sh
npm install -g codetree-cli
# Analyze current directory
codetree .
# Analyze specific directory
codetree /path/to/project
# Create local configuration
codetree init
# Create global configuration
codetree init --global
# Enable debug output
DEBUG=true codetree .
CodeTree can be customized using configuration files in multiple locations:
- Global configuration:
~/.codetreerc
- Project configuration:
.codetreerc
orcodetree.config.json
- Package.json:
"codetree"
field
{
"output": {
"filename": "custom-analysis.txt",
"maxFileSize": 10,
"showContent": true,
"showSize": true,
"showLineCount": true
},
"groups": {
"programming": {
"enabled": true,
"extensions": [".custom", ".specific"]
},
"web": {
"enabled": false
}
},
"include": {
"extensions": [".myext"],
"files": ["specific-file.txt"],
"patterns": ["**/*.custom"]
},
"exclude": {
"extensions": [".test.js"],
"files": ["debug.log"],
"patterns": ["**/*.min.js"]
},
"ignore": {
"defaults": true,
"custom": ["my-temp-dir"],
"patterns": ["**/build-*/**"]
}
}
CodeTree organizes file extensions into groups that can be enabled/disabled:
programming
: General programming languagesweb
: Web development filesconfig
: Configuration filesdocs
: Documentation filesscripts
: Shell and script filesdata
: Data and database files
Each group can be customized or disabled in your configuration.
CodeTree supports glob patterns for flexible file matching:
{
"include": {
"patterns": [
"src/**/*.js",
"lib/*.{js,ts}"
]
},
"exclude": {
"patterns": [
"**/*.test.js",
"**/*.spec.js"
]
}
}
project/
βββ src/ (1.2 MB)
β βββ index.js (100 lines, 2.5 KB)
β β Content:
β β // File contents here
β βββ utils/
β βββ helper.js (50 lines, 1.1 KB)
β Content:
β // File contents here
βββ package.json (30 lines, 750 B)
Enable detailed logging:
DEBUG=true codetree .
Create your own extension group in .codetreerc
:
{
"groups": {
"myCustomGroup": {
"enabled": true,
"extensions": [".custom", ".specific"]
}
}
}
- Command-line arguments
- Project-specific config
- Global config
- Default settings
-
Permission Denied
sudo ./install.sh
-
Command Not Found
source ~/.bashrc # For Bash source ~/.zshrc # For Zsh
-
File Size Limits
- Default limit: 5MB
- Customize in config:
{ "output": { "maxFileSize": 10 } }
Contributions are welcome! Here's how:
- Fork the repository
- Create your branch:
git checkout -b feature/AmazingFeature
- Make changes and commit:
git commit -m 'Add AmazingFeature'
- Push to your branch:
git push origin feature/AmazingFeature
- Open a Pull Request
# Install dependencies
npm install
# Run tests
npm test
# Run linter
npm run lint
# Format code
npm run format
This project is licensed under the MIT License - see the LICENSE file for details.
- Initial release
- Smart configuration system
- Extension group management
- Glob pattern support
- Advanced file filtering
- Size and line count analysis
- Debug mode
- Global and local configs
Made with β€οΈ by Mostafa Alahyari