A powerful command-line tool to display directory tree structure with various configuration options and output formats.
npm install -g tree-cli-tool
# Display tree structure of current directory
tree-cli
# Display tree structure of specified directory
tree-cli /path/to/directory
# Limit traversal depth
tree-cli -d 3
# Show file sizes
tree-cli -s
# Output as JSON format
tree-cli -f json
# Exclude specific files/directories
tree-cli -e "node_modules" "*.log" ".git"
[path]
- Target directory path (default: current directory)-d, --max-depth <number>
- Maximum traversal depth, -1 for unlimited (default: -1)-f, --format <type>
- Output format: text|json|markdown (default: text)
-e, --exclude <patterns...>
- Exclude patterns (supports glob style)--include-types <types...>
- Include only specified file types (extensions)--exclude-types <types...>
- Exclude specified file types (extensions)-i, --ignore-pattern <regex>
- Regular expression ignore pattern
-a, --show-hidden
- Show hidden files and directories-s, --show-size
- Show file sizes--show-date
- Show modification times-D, --dirs-only
- Show directories only--no-color
- Disable colored output
-o, --output <file>
- Output to file instead of stdout
Quick directory structure view, automatically excludes common build directories:
tree-cli quick [path] [-d depth]
Automatically excludes: node_modules
, .git
, dist
, build
, .next
, .nuxt
Developer-friendly view, excludes more build and cache directories:
tree-cli dev [path] [-d depth]
Automatically excludes: node_modules
, .git
, dist
, build
, .next
, .nuxt
, coverage
, .nyc_output
, .cache
, tmp
, temp
, *.log
, .DS_Store
, Thumbs.db
tree-cli
tree-cli -d 2 -s
tree-cli --include-types js ts jsx tsx
tree-cli -e "node_modules" "dist" --exclude-types log tmp
tree-cli -f json -o tree.json
tree-cli -i "test.*\\.js$"
tree-cli dev -d 3
project/
├── src/
│ ├── components/
│ │ └── Button.tsx
│ └── index.ts
├── package.json
└── README.md
2 directories, 3 files
{
"tree": {
"name": "project",
"path": "/path/to/project",
"isDirectory": true,
"children": [...]
},
"stats": {
"totalFiles": 3,
"totalDirectories": 2,
"totalSize": 1024
}
}
# Directory Tree: project
- **project**/
- **src**/
- **components**/
- Button.tsx
- index.ts
- package.json
- README.md
## Statistics
- **Directories**: 2
- **Files**: 3
import { generateTree } from 'tree-cli-tool';
const result = await generateTree({
path: './my-project',
maxDepth: 3,
format: 'json',
exclude: ['node_modules', '.git'],
showSize: true,
});
console.log(result.formatted);
console.log('Stats:', result.stats);
# Clone repository
git clone https://github.com/oyal/tree-cli-tool.git
cd tree-cli-tool
# Install dependencies
npm install
# Run in development mode
npm run dev
# Build project
npm run build
# Run tests
npm test
# Format code
npm run format
# Check code formatting
npm run format:check
The project is configured with the following code quality tools:
- Prettier: Code formatting
- GitHub Actions: Automated CI/CD pipeline
Code quality checks run automatically at:
- GitHub Actions CI pipeline
- Pre-publish checks (prepublishOnly)
This project uses GitHub Actions for automated publishing:
-
Automated Publishing (Recommended):
- Go to GitHub Actions page
- Select "Publish" workflow
- Choose version type (patch/minor/major)
- Click run
-
Manual Publishing:
npm version patch # or minor, major git push origin main --tags
- Fork this repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Create a Pull Request
MIT