treecat
is a powerful CLI tool that combines directory tree visualization with file content preview capabilities. It works in both interactive and non-interactive modes, perfect for developers who need to quickly explore project structures or document codebases.
- Interactive & Non-interactive Modes: Choose between guided prompts or CLI arguments
-
Smart Filtering:
- Filter by file extensions (
.js
,.md
, etc.) - Match filename patterns (
*.spec.js
,test-*.ts
) - Respect
.gitignore
rules
- Filter by file extensions (
-
Content Inspection:
- Highlight keywords in file contents
- Preview files directly in terminal
-
Multiple Output Formats:
- Terminal display with syntax highlighting
- Export to TXT, Markdown, JSON, and HTML
- Generate ZIP archives of scanned files
-
Configuration:
- Save and reuse scan configurations
- Customizable file size limits
-
Performance Tracking:
- Scan statistics and timing
- Error logging for unreadable files
npm install -g treecat
yarn global add treecat
git clone https://github.com/nzingx/treecat.git
cd treecat
npm install
npm link
treecat
Follow the interactive prompts to configure your scan.
treecat --path ./src --ext .js,.jsx --keyword TODO --output md
Option | Description |
---|---|
-p, --path <dir> |
Target directory to scan |
-e, --ext <extensions> |
Comma-separated file extensions |
--pattern <patterns> |
Filename patterns (glob) |
-k, --keyword <text> |
Highlight keyword in contents |
-o, --output <format> |
Output format (txt, md, json, html) |
--exclude-gitignore |
Respect .gitignore rules (default: true) |
--save-config |
Save current settings |
-c, --config <path> |
Load config from file |
treecat --version # Show version
treecat --license # Show license
treecat --docs # Open documentation
treecat --issues # View issue tracker
Example .treecatrc.json
:
{
"version": "1.0.1",
"targetDir": "./src",
"excludeGitignore": true,
"extensions": [".js", ".jsx"],
"patterns": ["*"],
"keyword": "TODO",
"outputChoice": "md",
"maxFileSize": 1048576,
"encoding": "utf-8"
}
project/
src/
index.js
utils/
helper.js
tests/
index.spec.js
# File: src/index.js
--------------------
import React from 'react';
// TODO: Add error boundary
const App = () => {...};
treecat/
├── bin
│ └── treecat.mjs
├── lib
│ ├── clearLine.js
│ ├── collectMatchedFiles.js
│ ├── constants.js
│ ├── createArchive.js
│ ├── deps.js
│ ├── errors.js
│ ├── executeScan.js
│ ├── formatBytes.js
│ ├── generateFileTree.js
│ ├── getTimestamp.js
│ ├── help.js
│ ├── loadConfig.js
│ ├── main.js
│ ├── outputHandler.js
│ ├── parseArguments.js
│ ├── processFileContents.js
│ ├── promptForOptions.js
│ ├── readGitignore.js
│ ├── renderTree.js
│ ├── safeReadFile.js
│ ├── saveConfig.js
│ └── state.js
├── LICENSE
├── package.json
└── README.md
This project is licensed under the EVL License. See LICENSE for details.
Found a bug or have a feature request? Please open an issue.
Developed with by nzingx