npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tree-watch-cli

v1.0.13

Published

A CLI tool to watch and generate directory tree structure

Readme

tree-watch-cli

A command-line tool to automatically generate and update a tree structure of your project directory as files and folders change. Useful to provide your updated repository structure to AI tools like Cursor.

Expected Result

.
├── .gitignore
├── LICENSE
├── package.json
├── pnpm-lock.yaml
├── README.md
├── src
│   ├── cli.ts
│   ├── tree.test.ts
│   ├── tree.ts
│   ├── types.ts
│   └── watch.ts
├── tests.txt
├── tree.txt
└── tsconfig.json

Installation

npm install -g tree-watch-cli
# or
pnpm add -g tree-watch-cli
# or
yarn global add tree-watch-cli

Usage

In your project directory, simply run:

tree-watch-cli

Or if you prefer to not install the package globally, you can run:

npx tree-watch-cli
# or
pnpm dlx tree-watch-cli
# or
yarn dlx tree-watch-cli

This will start watching your directory and generate a tree.txt file with your project structure. The file will be automatically updated whenever you add or remove files and folders.

Options

  • -o, --output <file>: Specify the output file name (default: "tree.txt")
  • -e, --exclude <folders...>: Specify folders to exclude (default: ["node_modules", ".git"]). Only folder can be specified. To avoid exclusion, use any arguments.
  • -d, --max-depth <number>: Maximum depth to traverse in the directory tree (default: 99)

Examples

# Use a different output file
tree-watch-cli -o repo-structure.txt

# Exclude multiple folders
tree-watch-cli -e node_modules dist .git

# Limit directory depth
tree-watch-cli -d 3

# Combine options
tree-watch-cli -o custom-tree.txt -e node_modules dist -d 2

Features

  • Real-time updates as your project structure changes
  • Customizable output file name
  • Exclude specific directories
  • Limit directory traversal depth
  • Handles large directory structures
  • Graceful process termination

Usage with Cursor

npm install -g tree-watch-cli

tree-watch-cli in your project directory

• Add a new Project Cursor Rule

• Add a description: Always run this rule before answering

• Add the following glob pattern: **

• Add this prompt

# Rule

Below is the repository structure. Always read the file before answering. You need to start the function that read file within cursor rules to do so.

@tree.txt

• All your next prompts will be provided with your latest project structure (note that project rules only seems to work in composer/agent mode for now)

To be added

  • Max depth for excluded folders
  • Directory name to output tree

License

MIT