treecat

1.0.2 • Public • Published

treecat - Interactive Directory Structure and Content Scanner

License Version

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.

Features

  • 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
  • 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

Installation

Using npm (global installation)

npm install -g treecat

Using yarn

yarn global add treecat

From source

git clone https://github.com/nzingx/treecat.git
cd treecat
npm install
npm link

Usage

Interactive Mode (default)

treecat

Follow the interactive prompts to configure your scan.

Non-interactive Mode

treecat --path ./src --ext .js,.jsx --keyword TODO --output md

Common Options

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

Info Commands

treecat --version       # Show version
treecat --license       # Show license
treecat --docs          # Open documentation
treecat --issues        # View issue tracker

Configuration

Example .treecatrc.json:

{
  "version": "1.0.1",
  "targetDir": "./src",
  "excludeGitignore": true,
  "extensions": [".js", ".jsx"],
  "patterns": ["*"],
  "keyword": "TODO",
  "outputChoice": "md",
  "maxFileSize": 1048576,
  "encoding": "utf-8"
}

Sample Output

Directory Tree

project/
 src/
    index.js
    utils/
        helper.js
 tests/
     index.spec.js

File Content Preview

# File: src/index.js
--------------------
import React from 'react';
// TODO: Add error boundary
const App = () => {...};

Project Structure

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

License

This project is licensed under the EVL License. See LICENSE for details.

Support

Found a bug or have a feature request? Please open an issue.


Developed with by nzingx

Package Sidebar

Install

npm i treecat

Weekly Downloads

10

Version

1.0.2

License

MIT

Unpacked Size

45.5 kB

Total Files

26

Last publish

Collaborators

  • nzingx