Skip to content

PratikDev/treeEx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TreeEx

A CLI tool that analyzes directory structures and outputs them as JSON. Built with Bun and TypeScript.

Why TreeEx?

Sometimes you just need a quick way to get a directory's structure as JSON - maybe for documentation, feeding into an LLM, or just understanding a codebase. TreeEx does exactly that, with sensible defaults and cross-platform support.

Installation

From source

Requirements:

  • Bun
  • Git
git clone https://github.com/pratikdev/treeex.git
cd treeex
bun install

Building

# Build for current platform
bun run build

# Check [package.json](./package.json) for more options

This produces a standalone binary in the build/ directory for your OS

Usage

# cd into the build directory
cd build

# Analyze current directory (`/build` directory will be empty though)
treeEx

# Analyze a specific path
treeEx ../src

# Limit depth
treeEx --depth 3

# Unlimited depth
treeEx --depth inf

# Ignore additional patterns
treeEx -i "*.log" -i "*.tmp"

# Include everything (disable default ignores)
treeEx --no-default-ignore

Output Format

TreeEx outputs a JSON tree structure:

{
  "name": "root",
  "type": "directory",
  "children": [
    {
      "name": "src",
      "type": "directory",
      "children": [
        {
          "name": "index.ts",
          "type": "file",
          "children": []
        }
      ]
    },
    {
      "name": "package.json",
      "type": "file",
      "children": []
    }
  ]
}

Default Ignore Patterns

By default, TreeEx ignores common noise directories and files:

  • .git, .svn, .hg, .CVS
  • node_modules, vendor
  • build, dist, out
  • .vscode, .DS_Store

Use --no-default-ignore to include everything.

Options

Option Description
-d, --depth <level> Maximum depth level (default: 20, use "inf" for unlimited)
-i, --ignore <pattern> Glob pattern to ignore (can be used multiple times)
--no-default-ignore Disable default ignore patterns
-v, --version Show version
-h, --help Show help

License

MIT

About

CLI tool that analyzes directory structure and outputs a JSON tree

Resources

License

Stars

Watchers

Forks

Packages

No packages published