A modern tree-style CLI for humans and AI prompts.
Project description
trls
trls is a modern tree-style CLI that renders file structures for humans and AI prompts.
It is built for two common workflows:
- inspect a project in the terminal with a cleaner, more readable tree view
- export a stable directory snapshot that can be pasted into prompts, docs, or automation
Why trls
Classic tree output is useful, but trls focuses on modern developer workflows:
richtree output by default for a polished terminal experiencepromptoutput for AI-friendly, copy-pasteable directory snapshots- snapshot diff by default, so each run shows what changed since last time
-cclipboard copy for a compact, paste-ready LLM format- always-on progress feedback during scans in interactive terminals
- richer colors for common media, office, and data files
textoutput for universal shell compatibilitymarkdownoutput for docs and prompt sharingjsonoutput for tooling and automation
The first release keeps the scope intentionally small: one command, predictable output, and formats that are easy to copy into AI conversations.
Install
pip install trls-cli
Quick start
Show the current directory:
trls
By default, this compares the current tree against the previous run for the same path. On first run, it simply prints the current tree and creates the baseline.
Export an AI-friendly directory snapshot:
trls . --format prompt
Copy a compact LLM-friendly version to the clipboard while keeping the normal terminal output:
trls . -c
In interactive terminals, trls also shows live scan progress so large trees do not feel stuck.
Snapshots are saved automatically after each run. If you want to refresh the baseline without showing any diff markers, force-save it explicitly:
trls . -save
Compare against the previous run for the same path:
trls . -diff
Compare against an explicit snapshot file:
trls . -compare snapshot.json --format prompt
Show a specific directory:
trls path/to/project
Limit traversal depth:
trls . --depth 2
Include hidden files:
trls . --hidden
Ignore noisy paths:
trls . --ignore ".git" --ignore "__pycache__" --ignore "*.pyc"
Export machine-readable output:
trls . --format json
Example output
Prompt output:
[dir] project/
[doc] README.md
[meta] pyproject.toml
[dir] src/
[dir] trls/
[py] cli.py
[py] tree.py
Text output:
project/
|-- README.md
|-- pyproject.toml
`-- src/
`-- trls/
|-- cli.py
`-- tree.py
Markdown output:
- `project/`
- `README.md`
- `pyproject.toml`
- `src/`
- `trls/`
- `cli.py`
- `tree.py`
Prompt diff output:
[dir] project/
~ [doc] README.md
[meta] pyproject.toml
[dir] src/
- [py] old.py
+ [py] new.py
Clipboard copy output with -c:
project/
src/trls/: cli.py
root: ~README.md
src/: +new_file.py, -old_file.py
Python API
trls can also be used as a small Python library:
from trls import render_prompt, scan_tree
tree = scan_tree("src", max_depth=2, ignore_patterns=["__pycache__", "*.pyc"])
print(render_prompt(tree))
Snapshot Diff
trls automatically persists a file tree snapshot after each run and can compare future scans against it.
Diff markers:
+added file or directory-removed file or directory~modified file or directory
Current behavior in v0.4.0:
- every successful run updates the latest snapshot for that path
- default
trlsoutput compares against the previous run for that path - the first
--diff-lastrun creates the baseline automatically if none exists yet - modification detection is hash-based for files
- directories are marked modified when any descendant changes
- explicit snapshots and automatic "last snapshot" comparison are both supported
Clipboard Copy
Use trls -c to keep the normal terminal render while also copying a compact prompt-oriented version to your clipboard.
Clipboard behavior:
- the first line keeps the root directory name
- later lines group entries by directory, such as
src/: cli.py, tree.py - top-level files are collected under
root: +,-, and~stay inline with each item to preserve diff meaning- the clipboard payload is intentionally different from the terminal render to save tokens
- WSL-aware clipboard fallbacks are attempted before reporting an error
Progress And Color UX
- interactive runs show a transient progress indicator while scanning
- image files such as
.jpgand.pnghave their own color family - video files such as
.mp4have their own color family - spreadsheet and office files such as
.xlsx,.csv,.docx, and.pptxhave their own color family - data-oriented files such as
.parquetand.ipynbare also colorized
CLI contract for v0.4.0
The first public release guarantees:
- scan the current directory or a user-provided path
- five output formats:
rich,prompt,text,markdown, andjson richis the default output format- default output is also a diff against the previous run when a baseline exists
- hidden files are excluded by default and included with
--hidden - ignore rules may be repeated with
--ignore - snapshots are automatically updated after successful runs
- snapshot diffing is available via
-save/--save-snapshot,-diff/--diff-last,-compare/--compare-with, and-update/--update-snapshot - clipboard copy is available via
-c/--copy - interactive scans show live progress feedback
- directories are listed before files and names are sorted case-insensitively
- unreadable directories are reported in the output instead of crashing the renderers
Development
On macOS or Linux:
python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -e ".[dev]"
pytest
On Windows PowerShell:
python -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
pip install -e ".[dev]"
pytest
Release
Build locally:
python -m build
twine check dist/*
Recommended flow:
- Upload a test release to TestPyPI.
- Verify
pip install,trls --version, and one real CLI example. - Publish the tagged release to PyPI with Trusted Publishing.
Remove-Item -Recurse -Force .\dist
python -m pytest
python -m build
python -m twine check dist/*
python -m twine upload --disable-progress-bar dist/*
See RELEASING.md and .github/workflows/publish.yml for the release checklist.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file trls_cli-0.4.0.tar.gz.
File metadata
- Download URL: trls_cli-0.4.0.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e93c196c87b4242d1876229874154a32f798883e9447bddbd333d7e34fc1fa94
|
|
| MD5 |
bb366b98b686df1a7f6b4bb10931b2f9
|
|
| BLAKE2b-256 |
53a3701b43d7501e4585b945daf4e16f8ad0d131ae8020e870f1077a00cefe58
|
File details
Details for the file trls_cli-0.4.0-py3-none-any.whl.
File metadata
- Download URL: trls_cli-0.4.0-py3-none-any.whl
- Upload date:
- Size: 13.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfac94ce6a8dfe30d8fe7c231895dfcd7252b4cb9238c6504dca0237a24a05f4
|
|
| MD5 |
9b48a4cee4f1a032389c6c1cffc5bf80
|
|
| BLAKE2b-256 |
28b3e2aa119f89486de64e3fca825a9c5d72964ab919546667624dd1f777ac13
|