Skip to content

Latest commit

 

History

History
115 lines (81 loc) · 2.29 KB

File metadata and controls

115 lines (81 loc) · 2.29 KB

🌳 tree Command

Overview

The tree command generates a structured view of your project structure.

It supports multiple output formats (JSON, Pretty JSON, YAML), respects configuration defined in .shtk.json, provides dry-run analysis (--dry-run), and computes character and token estimation metrics.

🇧🇷 Leia em Português


Usage

shtk tree [options]

Examples

Default output (JSON)

shtk tree

Dry Run analysis (without copying or writing files)

shtk tree --dry-run

Output example:

📋 Tree Dry Run

📁 Folders     : 13
📄 Files       : 40
🔢 Characters  : 2300
🧠 Est. Tokens : ~575
🚚 Delivery    : text
📦 File Name   : shtoolkit-tree.json

Pretty output

shtk tree --pretty

YAML output

shtk tree --yaml

Print to terminal

shtk tree --stdout

Save to file

shtk tree --file

Limit depth & directories only

shtk tree --depth 2 --dirs-only

Clipboard overrides

Force copy as text:

shtk tree --copy-as text

Force copy as file:

shtk tree --copy-as file

Options

Option Description
--stdout Print output to terminal
--file Save output to file
--output <file> Define output file name
--pretty Pretty-print JSON output
--yaml Output as YAML
--depth <number> Limit traversal depth
--dirs-only Include only directories
--path <dir> Define target path
--copy-as Set copy mode (text, file, auto)
--text-max-chars Max characters before copying as file
--dry-run Analyze tree structure and delivery without copying or writing
-h, --help Show help

Behavior & Metrics

  • Reads configuration from .shtk.json and applies ignore rules.
  • Calculates exact formatted character count and estimated tokens (Math.ceil(characters / 4)).
  • Integrates with deliverOutput to copy output intelligently as text or a temporary file.
  • Includes safe text fallback if system file clipboard operations fail.