Skip to main content

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:

  • rich tree output by default for a polished terminal experience
  • prompt output for AI-friendly, copy-pasteable directory snapshots
  • snapshot diff by default, so each run shows what changed since last time
  • -c clipboard copy for a compact, paste-ready LLM format
  • --skill output for agent workflows, with automatic clipboard copy
  • always-on progress feedback during scans in interactive terminals
  • richer colors for common media, office, and data files
  • text output for universal shell compatibility
  • markdown output for docs and prompt sharing
  • json output 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

Print the built-in agent skill text and copy it to the clipboard:

trls --skill

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.5.0:

  • every successful run updates the latest snapshot for that path
  • default trls output compares against the previous run for that path
  • the first --diff-last run 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

Agent Skill Output

Use trls -skill or trls --skill to print a built-in English skill block for Cursor-style agents and copy it to the clipboard automatically.

Skill behavior:

  • prints a ready-to-paste agent instruction block to stdout
  • copies the same text to the clipboard automatically
  • tells agents to prefer trls for file structure analysis before broad manual exploration
  • suggests --format prompt, --depth, --ignore, and -diff as the primary workflow

Recommended agent command order:

  1. Run trls <path> --format prompt for the first structure pass.
  2. Add --depth <n> if the repository is too large.
  3. Add repeated --ignore <pattern> options to remove noisy folders such as .git, node_modules, dist, or build output.
  4. Add --hidden only when hidden files are likely relevant.
  5. Use -diff when you want to compare against the previous snapshot.
  6. Use -c when you want a compact clipboard-oriented summary.

Common agent examples:

trls . --format prompt
trls . --format prompt --depth 2
trls . --format prompt --ignore .git --ignore node_modules --ignore dist
trls src --format prompt --depth 3
trls . -diff --format prompt
trls . -c
trls --skill

Progress And Color UX

  • interactive runs show a transient progress indicator while scanning
  • image files such as .jpg and .png have their own color family
  • video files such as .mp4 have their own color family
  • spreadsheet and office files such as .xlsx, .csv, .docx, and .pptx have their own color family
  • data-oriented files such as .parquet and .ipynb are also colorized

CLI contract for v0.5.0

The first public release guarantees:

  • scan the current directory or a user-provided path
  • five output formats: rich, prompt, text, markdown, and json
  • rich is 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
  • agent skill output is available via -skill/--skill
  • 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:

  1. Upload a test release to TestPyPI.
  2. Verify pip install, trls --version, and one real CLI example.
  3. Publish the tagged release to PyPI with Trusted Publishing.

.venv\Scripts\Activate.ps1 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.

Metadata

Release files for trls-cli 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for trls-cli 0.5.0
File Size Uploaded Provenance Actions
trls_cli-0.5.0.tar.gz 18.1 kB Without provenance Details for trls_cli-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for trls-cli 0.5.0
File Interpreter ABI Platform Actions
trls_cli-0.5.0-py3-none-any.whl Python 3 none any Details for trls_cli-0.5.0-py3-none-any.whl

Total release size: 34.6 kB

Release files / trls_cli-0.5.0.tar.gz

Download URL trls_cli-0.5.0.tar.gz
Size 18.1 kB
Tags Source
SHA-256 checksum
How to use checksums
93dfb6a9827b835613e6a61e69885686f6bdd311ae8064a92e7d163189f36ee1
BLAKE2b-256 checksum
How to use checksums
cc38858e6d43fdfafae936927d8dddd65d1c2b1e208fc4def9d79f3d1d692a0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.12

Release files / trls_cli-0.5.0-py3-none-any.whl

Download URL trls_cli-0.5.0-py3-none-any.whl
Size 16.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3dc61757daaba7d4e8364791b16634407661084d5c5f3c2c7ee2032b529fc144
BLAKE2b-256 checksum
How to use checksums
5fcfcaf709597b3e67adac33d485be0c942e457bb5956ada51812dce60fa92d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.12

Security for trls-cli 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page