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.
shtk tree [options]shtk treeshtk tree --dry-runOutput example:
📋 Tree Dry Run
📁 Folders : 13
📄 Files : 40
🔢 Characters : 2300
🧠 Est. Tokens : ~575
🚚 Delivery : text
📦 File Name : shtoolkit-tree.jsonshtk tree --prettyshtk tree --yamlshtk tree --stdoutshtk tree --fileshtk tree --depth 2 --dirs-onlyForce copy as text:
shtk tree --copy-as textForce copy as file:
shtk tree --copy-as file| 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 |
- Reads configuration from
.shtk.jsonand applies ignore rules. - Calculates exact formatted character count and estimated tokens (
Math.ceil(characters / 4)). - Integrates with
deliverOutputto copy output intelligently as text or a temporary file. - Includes safe text fallback if system file clipboard operations fail.