trls-cli 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ .pytest_cache/
2
+ .venv/
3
+ build/
4
+ dist/
5
+ *.egg-info/
6
+ __pycache__/
7
+ *.pyc
trls_cli-0.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yuanben
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,281 @@
1
+ Metadata-Version: 2.4
2
+ Name: trls-cli
3
+ Version: 0.2.0
4
+ Summary: A modern tree-style CLI for humans and AI prompts.
5
+ Author: Yonglin and Yuanben
6
+ License: MIT
7
+ License-File: LICENSE
8
+ Keywords: cli,filesystem,llm,prompt,tree
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Classifier: Topic :: Utilities
19
+ Requires-Python: >=3.9
20
+ Requires-Dist: rich>=13.9.0
21
+ Provides-Extra: dev
22
+ Requires-Dist: build>=1.2.2; extra == 'dev'
23
+ Requires-Dist: pytest>=8.3.4; extra == 'dev'
24
+ Requires-Dist: twine>=6.1.0; extra == 'dev'
25
+ Description-Content-Type: text/markdown
26
+
27
+ # trls
28
+
29
+ `trls` is a modern tree-style CLI that renders file structures for humans and AI prompts.
30
+
31
+ It is built for two common workflows:
32
+
33
+ - inspect a project in the terminal with a cleaner, more readable tree view
34
+ - export a stable directory snapshot that can be pasted into prompts, docs, or automation
35
+
36
+ ## Why `trls`
37
+
38
+ Classic `tree` output is useful, but `trls` focuses on modern developer workflows:
39
+
40
+ - `rich` tree output by default for a polished terminal experience
41
+ - `prompt` output for AI-friendly, copy-pasteable directory snapshots
42
+ - snapshot diff by default, so each run shows what changed since last time
43
+ - `-c` clipboard copy for a compact, paste-ready LLM format
44
+ - `text` output for universal shell compatibility
45
+ - `markdown` output for docs and prompt sharing
46
+ - `json` output for tooling and automation
47
+
48
+ The first release keeps the scope intentionally small: one command, predictable output, and formats that are easy to copy into AI conversations.
49
+
50
+ ## Install
51
+
52
+ ```bash
53
+ pip install trls-cli
54
+ ```
55
+
56
+ ## Quick start
57
+
58
+ Show the current directory:
59
+
60
+ ```bash
61
+ trls
62
+ ```
63
+
64
+ 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.
65
+
66
+ Export an AI-friendly directory snapshot:
67
+
68
+ ```bash
69
+ trls . --format prompt
70
+ ```
71
+
72
+ Copy a compact LLM-friendly version to the clipboard while keeping the normal terminal output:
73
+
74
+ ```bash
75
+ trls . -c
76
+ ```
77
+
78
+ Snapshots are saved automatically after each run. If you want to refresh the baseline without showing any diff markers, force-save it explicitly:
79
+
80
+ ```bash
81
+ trls . -save
82
+ ```
83
+
84
+ Compare against the previous run for the same path:
85
+
86
+ ```bash
87
+ trls . -diff
88
+ ```
89
+
90
+ Compare against an explicit snapshot file:
91
+
92
+ ```bash
93
+ trls . -compare snapshot.json --format prompt
94
+ ```
95
+
96
+ Show a specific directory:
97
+
98
+ ```bash
99
+ trls path/to/project
100
+ ```
101
+
102
+ Limit traversal depth:
103
+
104
+ ```bash
105
+ trls . --depth 2
106
+ ```
107
+
108
+ Include hidden files:
109
+
110
+ ```bash
111
+ trls . --hidden
112
+ ```
113
+
114
+ Ignore noisy paths:
115
+
116
+ ```bash
117
+ trls . --ignore ".git" --ignore "__pycache__" --ignore "*.pyc"
118
+ ```
119
+
120
+ Export machine-readable output:
121
+
122
+ ```bash
123
+ trls . --format json
124
+ ```
125
+
126
+ ## Example output
127
+
128
+ Prompt output:
129
+
130
+ ```text
131
+ [dir] project/
132
+ [doc] README.md
133
+ [meta] pyproject.toml
134
+ [dir] src/
135
+ [dir] trls/
136
+ [py] cli.py
137
+ [py] tree.py
138
+ ```
139
+
140
+ Text output:
141
+
142
+ ```text
143
+ project/
144
+ |-- README.md
145
+ |-- pyproject.toml
146
+ `-- src/
147
+ `-- trls/
148
+ |-- cli.py
149
+ `-- tree.py
150
+ ```
151
+
152
+ Markdown output:
153
+
154
+ ```markdown
155
+ - `project/`
156
+ - `README.md`
157
+ - `pyproject.toml`
158
+ - `src/`
159
+ - `trls/`
160
+ - `cli.py`
161
+ - `tree.py`
162
+ ```
163
+
164
+ Prompt diff output:
165
+
166
+ ```text
167
+ [dir] project/
168
+ ~ [doc] README.md
169
+ [meta] pyproject.toml
170
+ [dir] src/
171
+ - [py] old.py
172
+ + [py] new.py
173
+ ```
174
+
175
+ Clipboard copy output with `-c`:
176
+
177
+ ```text
178
+ project/
179
+ project/src/
180
+ project/src/trls/
181
+ project/src/trls/cli.py
182
+ ~ project/README.md
183
+ + project/src/new_file.py
184
+ - project/src/old_file.py
185
+ ```
186
+
187
+ ## Python API
188
+
189
+ `trls` can also be used as a small Python library:
190
+
191
+ ```python
192
+ from trls import render_prompt, scan_tree
193
+
194
+ tree = scan_tree("src", max_depth=2, ignore_patterns=["__pycache__", "*.pyc"])
195
+ print(render_prompt(tree))
196
+ ```
197
+
198
+ ## Snapshot Diff
199
+
200
+ `trls` automatically persists a file tree snapshot after each run and can compare future scans against it.
201
+
202
+ Diff markers:
203
+
204
+ - `+` added file or directory
205
+ - `-` removed file or directory
206
+ - `~` modified file or directory
207
+
208
+ Current behavior in `v0.2.0`:
209
+
210
+ - every successful run updates the latest snapshot for that path
211
+ - default `trls` output compares against the previous run for that path
212
+ - the first `--diff-last` run creates the baseline automatically if none exists yet
213
+ - modification detection is hash-based for files
214
+ - directories are marked modified when any descendant changes
215
+ - explicit snapshots and automatic "last snapshot" comparison are both supported
216
+
217
+ ## Clipboard Copy
218
+
219
+ Use `trls -c` to keep the normal terminal render while also copying a compact prompt-oriented version to your clipboard.
220
+
221
+ Clipboard behavior:
222
+
223
+ - the first line keeps the root directory name
224
+ - every later line uses a full root-prefixed path
225
+ - `+`, `-`, and `~` diff markers are preserved
226
+ - the clipboard payload is intentionally different from the terminal render to save tokens
227
+
228
+ ## CLI contract for `v0.2.0`
229
+
230
+ The first public release guarantees:
231
+
232
+ - scan the current directory or a user-provided path
233
+ - five output formats: `rich`, `prompt`, `text`, `markdown`, and `json`
234
+ - `rich` is the default output format
235
+ - default output is also a diff against the previous run when a baseline exists
236
+ - hidden files are excluded by default and included with `--hidden`
237
+ - ignore rules may be repeated with `--ignore`
238
+ - snapshots are automatically updated after successful runs
239
+ - snapshot diffing is available via `-save`/`--save-snapshot`, `-diff`/`--diff-last`, `-compare`/`--compare-with`, and `-update`/`--update-snapshot`
240
+ - clipboard copy is available via `-c`/`--copy`
241
+ - directories are listed before files and names are sorted case-insensitively
242
+ - unreadable directories are reported in the output instead of crashing the renderers
243
+
244
+ ## Development
245
+
246
+ On macOS or Linux:
247
+
248
+ ```bash
249
+ python -m venv .venv
250
+ source .venv/bin/activate
251
+ python -m pip install --upgrade pip
252
+ pip install -e ".[dev]"
253
+ pytest
254
+ ```
255
+
256
+ On Windows PowerShell:
257
+
258
+ ```powershell
259
+ python -m venv .venv
260
+ .venv\Scripts\Activate.ps1
261
+ python -m pip install --upgrade pip
262
+ pip install -e ".[dev]"
263
+ pytest
264
+ ```
265
+
266
+ ## Release
267
+
268
+ Build locally:
269
+
270
+ ```bash
271
+ python -m build
272
+ twine check dist/*
273
+ ```
274
+
275
+ Recommended flow:
276
+
277
+ 1. Upload a test release to TestPyPI.
278
+ 2. Verify `pip install`, `trls --version`, and one real CLI example.
279
+ 3. Publish the tagged release to PyPI with Trusted Publishing.
280
+
281
+ See `RELEASING.md` and `.github/workflows/publish.yml` for the release checklist.
@@ -0,0 +1,255 @@
1
+ # trls
2
+
3
+ `trls` is a modern tree-style CLI that renders file structures for humans and AI prompts.
4
+
5
+ It is built for two common workflows:
6
+
7
+ - inspect a project in the terminal with a cleaner, more readable tree view
8
+ - export a stable directory snapshot that can be pasted into prompts, docs, or automation
9
+
10
+ ## Why `trls`
11
+
12
+ Classic `tree` output is useful, but `trls` focuses on modern developer workflows:
13
+
14
+ - `rich` tree output by default for a polished terminal experience
15
+ - `prompt` output for AI-friendly, copy-pasteable directory snapshots
16
+ - snapshot diff by default, so each run shows what changed since last time
17
+ - `-c` clipboard copy for a compact, paste-ready LLM format
18
+ - `text` output for universal shell compatibility
19
+ - `markdown` output for docs and prompt sharing
20
+ - `json` output for tooling and automation
21
+
22
+ The first release keeps the scope intentionally small: one command, predictable output, and formats that are easy to copy into AI conversations.
23
+
24
+ ## Install
25
+
26
+ ```bash
27
+ pip install trls-cli
28
+ ```
29
+
30
+ ## Quick start
31
+
32
+ Show the current directory:
33
+
34
+ ```bash
35
+ trls
36
+ ```
37
+
38
+ 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.
39
+
40
+ Export an AI-friendly directory snapshot:
41
+
42
+ ```bash
43
+ trls . --format prompt
44
+ ```
45
+
46
+ Copy a compact LLM-friendly version to the clipboard while keeping the normal terminal output:
47
+
48
+ ```bash
49
+ trls . -c
50
+ ```
51
+
52
+ Snapshots are saved automatically after each run. If you want to refresh the baseline without showing any diff markers, force-save it explicitly:
53
+
54
+ ```bash
55
+ trls . -save
56
+ ```
57
+
58
+ Compare against the previous run for the same path:
59
+
60
+ ```bash
61
+ trls . -diff
62
+ ```
63
+
64
+ Compare against an explicit snapshot file:
65
+
66
+ ```bash
67
+ trls . -compare snapshot.json --format prompt
68
+ ```
69
+
70
+ Show a specific directory:
71
+
72
+ ```bash
73
+ trls path/to/project
74
+ ```
75
+
76
+ Limit traversal depth:
77
+
78
+ ```bash
79
+ trls . --depth 2
80
+ ```
81
+
82
+ Include hidden files:
83
+
84
+ ```bash
85
+ trls . --hidden
86
+ ```
87
+
88
+ Ignore noisy paths:
89
+
90
+ ```bash
91
+ trls . --ignore ".git" --ignore "__pycache__" --ignore "*.pyc"
92
+ ```
93
+
94
+ Export machine-readable output:
95
+
96
+ ```bash
97
+ trls . --format json
98
+ ```
99
+
100
+ ## Example output
101
+
102
+ Prompt output:
103
+
104
+ ```text
105
+ [dir] project/
106
+ [doc] README.md
107
+ [meta] pyproject.toml
108
+ [dir] src/
109
+ [dir] trls/
110
+ [py] cli.py
111
+ [py] tree.py
112
+ ```
113
+
114
+ Text output:
115
+
116
+ ```text
117
+ project/
118
+ |-- README.md
119
+ |-- pyproject.toml
120
+ `-- src/
121
+ `-- trls/
122
+ |-- cli.py
123
+ `-- tree.py
124
+ ```
125
+
126
+ Markdown output:
127
+
128
+ ```markdown
129
+ - `project/`
130
+ - `README.md`
131
+ - `pyproject.toml`
132
+ - `src/`
133
+ - `trls/`
134
+ - `cli.py`
135
+ - `tree.py`
136
+ ```
137
+
138
+ Prompt diff output:
139
+
140
+ ```text
141
+ [dir] project/
142
+ ~ [doc] README.md
143
+ [meta] pyproject.toml
144
+ [dir] src/
145
+ - [py] old.py
146
+ + [py] new.py
147
+ ```
148
+
149
+ Clipboard copy output with `-c`:
150
+
151
+ ```text
152
+ project/
153
+ project/src/
154
+ project/src/trls/
155
+ project/src/trls/cli.py
156
+ ~ project/README.md
157
+ + project/src/new_file.py
158
+ - project/src/old_file.py
159
+ ```
160
+
161
+ ## Python API
162
+
163
+ `trls` can also be used as a small Python library:
164
+
165
+ ```python
166
+ from trls import render_prompt, scan_tree
167
+
168
+ tree = scan_tree("src", max_depth=2, ignore_patterns=["__pycache__", "*.pyc"])
169
+ print(render_prompt(tree))
170
+ ```
171
+
172
+ ## Snapshot Diff
173
+
174
+ `trls` automatically persists a file tree snapshot after each run and can compare future scans against it.
175
+
176
+ Diff markers:
177
+
178
+ - `+` added file or directory
179
+ - `-` removed file or directory
180
+ - `~` modified file or directory
181
+
182
+ Current behavior in `v0.2.0`:
183
+
184
+ - every successful run updates the latest snapshot for that path
185
+ - default `trls` output compares against the previous run for that path
186
+ - the first `--diff-last` run creates the baseline automatically if none exists yet
187
+ - modification detection is hash-based for files
188
+ - directories are marked modified when any descendant changes
189
+ - explicit snapshots and automatic "last snapshot" comparison are both supported
190
+
191
+ ## Clipboard Copy
192
+
193
+ Use `trls -c` to keep the normal terminal render while also copying a compact prompt-oriented version to your clipboard.
194
+
195
+ Clipboard behavior:
196
+
197
+ - the first line keeps the root directory name
198
+ - every later line uses a full root-prefixed path
199
+ - `+`, `-`, and `~` diff markers are preserved
200
+ - the clipboard payload is intentionally different from the terminal render to save tokens
201
+
202
+ ## CLI contract for `v0.2.0`
203
+
204
+ The first public release guarantees:
205
+
206
+ - scan the current directory or a user-provided path
207
+ - five output formats: `rich`, `prompt`, `text`, `markdown`, and `json`
208
+ - `rich` is the default output format
209
+ - default output is also a diff against the previous run when a baseline exists
210
+ - hidden files are excluded by default and included with `--hidden`
211
+ - ignore rules may be repeated with `--ignore`
212
+ - snapshots are automatically updated after successful runs
213
+ - snapshot diffing is available via `-save`/`--save-snapshot`, `-diff`/`--diff-last`, `-compare`/`--compare-with`, and `-update`/`--update-snapshot`
214
+ - clipboard copy is available via `-c`/`--copy`
215
+ - directories are listed before files and names are sorted case-insensitively
216
+ - unreadable directories are reported in the output instead of crashing the renderers
217
+
218
+ ## Development
219
+
220
+ On macOS or Linux:
221
+
222
+ ```bash
223
+ python -m venv .venv
224
+ source .venv/bin/activate
225
+ python -m pip install --upgrade pip
226
+ pip install -e ".[dev]"
227
+ pytest
228
+ ```
229
+
230
+ On Windows PowerShell:
231
+
232
+ ```powershell
233
+ python -m venv .venv
234
+ .venv\Scripts\Activate.ps1
235
+ python -m pip install --upgrade pip
236
+ pip install -e ".[dev]"
237
+ pytest
238
+ ```
239
+
240
+ ## Release
241
+
242
+ Build locally:
243
+
244
+ ```bash
245
+ python -m build
246
+ twine check dist/*
247
+ ```
248
+
249
+ Recommended flow:
250
+
251
+ 1. Upload a test release to TestPyPI.
252
+ 2. Verify `pip install`, `trls --version`, and one real CLI example.
253
+ 3. Publish the tagged release to PyPI with Trusted Publishing.
254
+
255
+ See `RELEASING.md` and `.github/workflows/publish.yml` for the release checklist.
@@ -0,0 +1,100 @@
1
+ # Releasing `trls`
2
+
3
+ This repository is prepared for a CLI-first PyPI release.
4
+
5
+ ## Current release assumptions
6
+
7
+ - distribution name: `trls-cli`
8
+ - import package: `trls`
9
+ - version: `0.2.0`
10
+ - release channel: TestPyPI first, then PyPI
11
+
12
+ At the time of preparation, `https://pypi.org/project/trls-cli/` should be re-checked right before uploading.
13
+
14
+ ## 1. Prepare the repository metadata
15
+
16
+ Before publishing, create the public GitHub repository and then add the real URLs back into `pyproject.toml` if you want them shown on PyPI.
17
+
18
+ Recommended URLs to add:
19
+
20
+ - homepage: `https://github.com/<owner>/trls`
21
+ - repository: `https://github.com/<owner>/trls`
22
+ - issues: `https://github.com/<owner>/trls/issues`
23
+
24
+ ## 2. Test locally
25
+
26
+ On Windows PowerShell:
27
+
28
+ ```powershell
29
+ python -m venv .venv
30
+ .venv\Scripts\Activate.ps1
31
+ python -m pip install --upgrade pip
32
+ pip install -e ".[dev]"
33
+ pytest
34
+ python -m build
35
+ python -m twine check dist/*
36
+ ```
37
+
38
+ On macOS or Linux:
39
+
40
+ ```bash
41
+ python -m venv .venv
42
+ source .venv/bin/activate
43
+ python -m pip install --upgrade pip
44
+ pip install -e ".[dev]"
45
+ pytest
46
+ python -m build
47
+ python -m twine check dist/*
48
+ ```
49
+
50
+ ## 3. Publish to TestPyPI
51
+
52
+ Create a TestPyPI account, then upload manually:
53
+
54
+ ```bash
55
+ python -m twine upload --repository testpypi dist/*
56
+ ```
57
+
58
+ Verify the release in a clean environment:
59
+
60
+ ```bash
61
+ pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple trls-cli
62
+ trls --version
63
+ trls . --format markdown
64
+ ```
65
+
66
+ ## 4. Configure Trusted Publishing
67
+
68
+ In both PyPI and TestPyPI:
69
+
70
+ 1. Create the project if it does not exist yet.
71
+ 2. Open the publishing settings.
72
+ 3. Add your GitHub repository.
73
+ 4. Register the workflow file `.github/workflows/publish.yml`.
74
+
75
+ The workflow already expects the `pypi` environment in GitHub Actions.
76
+
77
+ ## 5. Release from a Git tag
78
+
79
+ After Trusted Publishing is configured:
80
+
81
+ ```bash
82
+ git tag v0.2.0
83
+ git push origin v0.2.0
84
+ ```
85
+
86
+ The GitHub Actions workflow will:
87
+
88
+ - install the package with dev dependencies
89
+ - run the test suite
90
+ - build wheel and source distributions
91
+ - publish to PyPI for version tags
92
+
93
+ ## First release checklist
94
+
95
+ 1. Confirm `trls-cli` is still available on PyPI.
96
+ 2. Create the public GitHub repository.
97
+ 3. Add the real repository URLs to `pyproject.toml`.
98
+ 4. Ensure README examples still match current CLI behavior.
99
+ 5. Upload to TestPyPI and validate installation.
100
+ 6. Push the `v0.2.0` tag to trigger the production release.
@@ -0,0 +1,55 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.27.0"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "trls-cli"
7
+ version = "0.2.0"
8
+ description = "A modern tree-style CLI for humans and AI prompts."
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ authors = [
12
+ { name = "Yonglin and Yuanben" }
13
+ ]
14
+ requires-python = ">=3.9"
15
+ dependencies = [
16
+ "rich>=13.9.0",
17
+ ]
18
+ keywords = ["tree", "cli", "filesystem", "prompt", "llm"]
19
+ classifiers = [
20
+ "Development Status :: 3 - Alpha",
21
+ "Intended Audience :: Developers",
22
+ "License :: OSI Approved :: MIT License",
23
+ "Programming Language :: Python :: 3",
24
+ "Programming Language :: Python :: 3.9",
25
+ "Programming Language :: Python :: 3.10",
26
+ "Programming Language :: Python :: 3.11",
27
+ "Programming Language :: Python :: 3.12",
28
+ "Topic :: Software Development :: Libraries :: Python Modules",
29
+ "Topic :: Utilities",
30
+ ]
31
+
32
+ [project.optional-dependencies]
33
+ dev = [
34
+ "build>=1.2.2",
35
+ "pytest>=8.3.4",
36
+ "twine>=6.1.0",
37
+ ]
38
+
39
+ [project.scripts]
40
+ trls = "trls.cli:main"
41
+
42
+ [tool.hatch.build.targets.wheel]
43
+ packages = ["src/trls"]
44
+
45
+ [tool.hatch.build.targets.sdist]
46
+ include = [
47
+ "/src",
48
+ "/tests",
49
+ "/README.md",
50
+ "/RELEASING.md",
51
+ "/LICENSE",
52
+ ]
53
+
54
+ [tool.pytest.ini_options]
55
+ testpaths = ["tests"]