dirplot 0.2.0__tar.gz → 0.3.1__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.
Files changed (113) hide show
  1. {dirplot-0.2.0 → dirplot-0.3.1}/.claude/settings.local.json +2 -1
  2. dirplot-0.3.1/.dockerignore +11 -0
  3. dirplot-0.3.1/CHANGELOG.md +167 -0
  4. dirplot-0.3.1/Dockerfile +21 -0
  5. {dirplot-0.2.0 → dirplot-0.3.1}/PKG-INFO +116 -23
  6. {dirplot-0.2.0 → dirplot-0.3.1}/README.md +103 -21
  7. {dirplot-0.2.0 → dirplot-0.3.1}/SECURITY.md +1 -1
  8. dirplot-0.3.1/docs/ARCHIVES.md +176 -0
  9. dirplot-0.3.1/docs/EXAMPLES.md +395 -0
  10. dirplot-0.3.1/docs/SSH_DESIGN.md +395 -0
  11. dirplot-0.3.1/docs/docker.png +0 -0
  12. dirplot-0.3.1/docs/fastapi.png +0 -0
  13. dirplot-0.3.1/docs/flask.png +0 -0
  14. dirplot-0.3.1/docs/k8s.png +0 -0
  15. dirplot-0.3.1/docs/pypy.png +0 -0
  16. dirplot-0.3.1/docs/python.png +0 -0
  17. dirplot-0.3.1/docs/s3.png +0 -0
  18. {dirplot-0.2.0 → dirplot-0.3.1}/pyproject.toml +17 -3
  19. dirplot-0.3.1/scripts/make_docs_images.sh +16 -0
  20. dirplot-0.3.1/scripts/make_fixtures.py +340 -0
  21. {dirplot-0.2.0 → dirplot-0.3.1}/src/dirplot/__init__.py +9 -1
  22. dirplot-0.3.1/src/dirplot/__main__.py +41 -0
  23. dirplot-0.3.1/src/dirplot/archives.py +359 -0
  24. dirplot-0.3.1/src/dirplot/docker.py +252 -0
  25. dirplot-0.3.1/src/dirplot/github.py +226 -0
  26. dirplot-0.3.1/src/dirplot/k8s.py +272 -0
  27. dirplot-0.3.1/src/dirplot/main.py +391 -0
  28. {dirplot-0.2.0 → dirplot-0.3.1}/src/dirplot/render.py +116 -50
  29. dirplot-0.3.1/src/dirplot/s3.py +167 -0
  30. {dirplot-0.2.0 → dirplot-0.3.1}/src/dirplot/scanner.py +37 -3
  31. dirplot-0.3.1/src/dirplot/ssh.py +228 -0
  32. dirplot-0.3.1/src/dirplot/svg_render.py +617 -0
  33. dirplot-0.3.1/src/dirplot/terminal.py +42 -0
  34. dirplot-0.3.1/src.svg +370 -0
  35. dirplot-0.3.1/tests/conftest.py +257 -0
  36. dirplot-0.3.1/tests/fixtures/sample.7z +0 -0
  37. dirplot-0.3.1/tests/fixtures/sample.a +0 -0
  38. dirplot-0.3.1/tests/fixtures/sample.aab +0 -0
  39. dirplot-0.3.1/tests/fixtures/sample.apk +0 -0
  40. dirplot-0.3.1/tests/fixtures/sample.cpio +0 -0
  41. dirplot-0.3.1/tests/fixtures/sample.ear +0 -0
  42. dirplot-0.3.1/tests/fixtures/sample.epub +0 -0
  43. dirplot-0.3.1/tests/fixtures/sample.ipa +0 -0
  44. dirplot-0.3.1/tests/fixtures/sample.iso +0 -0
  45. dirplot-0.3.1/tests/fixtures/sample.jar +0 -0
  46. dirplot-0.3.1/tests/fixtures/sample.nupkg +0 -0
  47. dirplot-0.3.1/tests/fixtures/sample.rar +0 -0
  48. dirplot-0.3.1/tests/fixtures/sample.tar +0 -0
  49. dirplot-0.3.1/tests/fixtures/sample.tar.bz2 +0 -0
  50. dirplot-0.3.1/tests/fixtures/sample.tar.gz +0 -0
  51. dirplot-0.3.1/tests/fixtures/sample.tar.xz +0 -0
  52. dirplot-0.3.1/tests/fixtures/sample.tar.zst +0 -0
  53. dirplot-0.3.1/tests/fixtures/sample.tbz2 +0 -0
  54. dirplot-0.3.1/tests/fixtures/sample.tgz +0 -0
  55. dirplot-0.3.1/tests/fixtures/sample.txz +0 -0
  56. dirplot-0.3.1/tests/fixtures/sample.tzst +0 -0
  57. dirplot-0.3.1/tests/fixtures/sample.vsix +0 -0
  58. dirplot-0.3.1/tests/fixtures/sample.war +0 -0
  59. dirplot-0.3.1/tests/fixtures/sample.whl +0 -0
  60. dirplot-0.3.1/tests/fixtures/sample.xar +0 -0
  61. dirplot-0.3.1/tests/fixtures/sample.xpi +0 -0
  62. dirplot-0.3.1/tests/fixtures/sample.zip +0 -0
  63. dirplot-0.3.1/tests/test_archives.py +590 -0
  64. {dirplot-0.2.0 → dirplot-0.3.1}/tests/test_cli.py +28 -12
  65. dirplot-0.3.1/tests/test_docker.py +386 -0
  66. {dirplot-0.2.0 → dirplot-0.3.1}/tests/test_drawing.py +8 -5
  67. dirplot-0.3.1/tests/test_github.py +216 -0
  68. dirplot-0.3.1/tests/test_k8s.py +447 -0
  69. dirplot-0.3.1/tests/test_s3.py +186 -0
  70. {dirplot-0.2.0 → dirplot-0.3.1}/tests/test_scanner.py +10 -0
  71. dirplot-0.3.1/tests/test_ssh.py +319 -0
  72. dirplot-0.3.1/tests/test_svg_render.py +402 -0
  73. {dirplot-0.2.0 → dirplot-0.3.1}/uv.lock +880 -5
  74. dirplot-0.2.0/CHANGELOG.md +0 -45
  75. dirplot-0.2.0/Untitled.ipynb +0 -90
  76. dirplot-0.2.0/map.svg +0 -213
  77. dirplot-0.2.0/src/dirplot/__main__.py +0 -11
  78. dirplot-0.2.0/src/dirplot/main.py +0 -153
  79. dirplot-0.2.0/src/dirplot/terminal.py +0 -29
  80. dirplot-0.2.0/tests/conftest.py +0 -30
  81. dirplot-0.2.0/treemap.png +0 -0
  82. {dirplot-0.2.0 → dirplot-0.3.1}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  83. {dirplot-0.2.0 → dirplot-0.3.1}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  84. {dirplot-0.2.0 → dirplot-0.3.1}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  85. {dirplot-0.2.0 → dirplot-0.3.1}/.github/dependabot.yml +0 -0
  86. {dirplot-0.2.0 → dirplot-0.3.1}/.github/workflows/ci.yml +0 -0
  87. {dirplot-0.2.0 → dirplot-0.3.1}/.github/workflows/publish.yml +0 -0
  88. {dirplot-0.2.0 → dirplot-0.3.1}/.gitignore +0 -0
  89. {dirplot-0.2.0 → dirplot-0.3.1}/.ipynb_checkpoints/Untitled-checkpoint.ipynb +0 -0
  90. {dirplot-0.2.0 → dirplot-0.3.1}/.pre-commit-config.yaml +0 -0
  91. {dirplot-0.2.0 → dirplot-0.3.1}/.python-version +0 -0
  92. {dirplot-0.2.0 → dirplot-0.3.1}/CONTRIBUTING.md +0 -0
  93. {dirplot-0.2.0 → dirplot-0.3.1}/LICENSE +0 -0
  94. {dirplot-0.2.0 → dirplot-0.3.1}/Makefile +0 -0
  95. {dirplot-0.2.0 → dirplot-0.3.1}/TASKS.md~ +0 -0
  96. {dirplot-0.2.0 → dirplot-0.3.1}/docs/dirplot.png +0 -0
  97. {dirplot-0.2.0 → dirplot-0.3.1}/scripts/open_terminals.sh +0 -0
  98. {dirplot-0.2.0 → dirplot-0.3.1}/src/dirplot/colors.py +0 -0
  99. {dirplot-0.2.0 → dirplot-0.3.1}/src/dirplot/display.py +0 -0
  100. {dirplot-0.2.0 → dirplot-0.3.1}/src/dirplot/fonts/JetBrainsMono-Bold.ttf +0 -0
  101. {dirplot-0.2.0 → dirplot-0.3.1}/src/dirplot/fonts/JetBrainsMono-BoldItalic.ttf +0 -0
  102. {dirplot-0.2.0 → dirplot-0.3.1}/src/dirplot/fonts/JetBrainsMono-Italic.ttf +0 -0
  103. {dirplot-0.2.0 → dirplot-0.3.1}/src/dirplot/fonts/JetBrainsMono-Regular.ttf +0 -0
  104. {dirplot-0.2.0 → dirplot-0.3.1}/src/dirplot/fonts/OFL.txt +0 -0
  105. {dirplot-0.2.0 → dirplot-0.3.1}/src/dirplot/py.typed +0 -0
  106. {dirplot-0.2.0 → dirplot-0.3.1}/tests/__init__.py +0 -0
  107. {dirplot-0.2.0 → dirplot-0.3.1}/tests/example/bar/bar.py +0 -0
  108. {dirplot-0.2.0 → dirplot-0.3.1}/tests/example/bar/baz.json +0 -0
  109. {dirplot-0.2.0 → dirplot-0.3.1}/tests/example/foo/foo.md +0 -0
  110. {dirplot-0.2.0 → dirplot-0.3.1}/tests/test_colors.py +0 -0
  111. {dirplot-0.2.0 → dirplot-0.3.1}/tests/test_display.py +0 -0
  112. {dirplot-0.2.0 → dirplot-0.3.1}/tests/test_render.py +0 -0
  113. {dirplot-0.2.0 → dirplot-0.3.1}/tests/test_terminal.py +0 -0
@@ -6,7 +6,8 @@
6
6
  "Bash(uv pip:*)",
7
7
  "Bash(git mv:*)",
8
8
  "Bash(LC_ALL=C sed:*)",
9
- "Bash(find:*)"
9
+ "Bash(find:*)",
10
+ "Bash(docker run:*)"
10
11
  ]
11
12
  }
12
13
  }
@@ -0,0 +1,11 @@
1
+ .venv/
2
+ .git/
3
+ .pytest_cache/
4
+ __pycache__/
5
+ *.pyc
6
+ *.egg-info/
7
+ dist/
8
+ .mypy_cache/
9
+ .ruff_cache/
10
+ *.png
11
+ *.svg
@@ -0,0 +1,167 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+
12
+ - `github://` URI now accepts an optional subpath after the repository name, letting
13
+ you scan a subdirectory directly:
14
+ - `github://owner/repo/sub/path` — subpath on the default branch
15
+ - `github://owner/repo@ref/sub/path` — subpath on a specific branch, tag, or commit SHA
16
+ - `https://github.com/owner/repo/tree/branch/sub/path` — full GitHub URL form
17
+ - Tags and commit SHAs are supported wherever a branch ref was previously accepted
18
+ (e.g. `github://torvalds/linux@v6.12`), as the GitHub trees API accepts any git ref.
19
+ - `--legend N` replaces the old boolean `--legend/--no-legend` flag. It now shows a
20
+ **file-count legend** — a sorted list of the top N extensions by number of files,
21
+ with a coloured swatch and the file count for each entry:
22
+ - Pass `--legend` alone to use the default of 20 entries.
23
+ - Pass `--legend 10` for a custom limit.
24
+ - Omit the flag entirely to show no legend.
25
+ - The number of rows is also capped automatically so the box never overflows the
26
+ image, based on available vertical space and the current `--font-size`.
27
+ - Extensions with the same count are sorted alphabetically as a tiebreaker.
28
+ - When the total number of extensions exceeds the limit, a `(+N more)` line is
29
+ appended at the bottom of the box.
30
+
31
+ - The root tile header now includes a summary of the scanned tree after an em-dash
32
+ separator: `myproject — 124 files, 18 dirs, 4.0 MB (4,231,680 bytes)`.
33
+ Applies to both PNG and SVG output. The label is truncated with `…` when the tile
34
+ is too narrow to fit the full string.
35
+
36
+ - Greatly expanded archive format support via the new `libarchive-c` core dependency
37
+ (wraps the system libarchive C library):
38
+ - **New formats**: `.iso`, `.cpio`, `.xar`, `.pkg`, `.dmg`, `.img`, `.rpm`, `.cab`,
39
+ `.lha`, `.lzh`, `.a`, `.ar`, `.tar.zst`, `.tzst`
40
+ - **New ZIP aliases**: `.nupkg` (NuGet), `.vsix` (VS Code extension), `.ipa` (iOS app),
41
+ `.aab` (Android App Bundle)
42
+ - `.tar.zst` / `.tzst` routed through libarchive for consistent behaviour across all
43
+ supported Python versions (stdlib `tarfile` only gained zstd support in 3.12).
44
+ - `libarchive-c>=5.0` added as a core dependency alongside `py7zr` and `rarfile`.
45
+ Requires the system libarchive library:
46
+ `brew install libarchive` / `apt install libarchive-dev`.
47
+ - See [ARCHIVES.md](docs/ARCHIVES.md) for the full format table, platform notes, and
48
+ intentionally unsupported formats (`.deb`, UDIF `.dmg`).
49
+ - Encrypted archive handling:
50
+ - `--password` CLI option passes a passphrase upfront.
51
+ - If an archive turns out to be encrypted and no password was given, dirplot prompts
52
+ interactively (`Password:` hidden-input prompt) and retries — no need to re-run with a flag.
53
+ - A wrong password exits cleanly with `Error: incorrect password.`
54
+ - `PasswordRequired` exception exported from `dirplot.archives` for programmatic use.
55
+ - **Encryption behaviour by format** (since dirplot reads metadata only, never extracts):
56
+ - ZIP and 7z: central directory / file list is unencrypted by default → readable without
57
+ a password even for encrypted archives.
58
+ - RAR with header encryption (`-hp`): listing is hidden without password;
59
+ wrong password raises `PasswordRequired`.
60
+
61
+ ### Fixed
62
+
63
+ - `--version` moved back to the top-level `dirplot` command (was accidentally scoped
64
+ to `dirplot map` after the CLI was restructured into subcommands).
65
+
66
+ ## [0.3.0] - 2026-03-10
67
+
68
+ ### Added
69
+
70
+ - Kubernetes pod scanning via `pod://pod-name/path` syntax — uses `kubectl exec` and
71
+ `find` to build the tree without copying files out of the pod. Works on any running
72
+ pod that has a POSIX shell and `find` (GNU or BusyBox). No extra dependency; only
73
+ `kubectl` is required.
74
+ - Namespace can be specified inline (`pod://pod-name@namespace:/path`) or via
75
+ `--k8s-namespace`.
76
+ - Container can be selected for multi-container pods via `--k8s-container`.
77
+ - `-xdev` is intentionally omitted so mounted volumes (emptyDir, PVC, etc.) within
78
+ the scanned path are traversed — the common case in k8s where images declare
79
+ `VOLUME` entries that are always mounted on a separate filesystem.
80
+ - Automatically falls back to a portable `sh` + `stat` loop on BusyBox/Alpine pods.
81
+ - Docker container scanning via `docker://container:/path` syntax — uses `docker exec`
82
+ and `find` to build the tree without copying files out of the container. Works on any
83
+ running container that has a POSIX shell and `find` (GNU or BusyBox). No extra
84
+ dependency; only the `docker` CLI is required.
85
+ - Automatically detects BusyBox `find` (Alpine-based images) and falls back to a
86
+ portable `sh` + `stat` loop when GNU `-printf` is unavailable.
87
+ - Virtual filesystems (`/proc`, `/sys`, `/dev`) are skipped via `-xdev`.
88
+ - Supports `--exclude`, `--depth`, `--log`, and all other standard options.
89
+ - `Dockerfile` and `.dockerignore` added so the project itself can be used as a
90
+ scan target.
91
+ - SVG output format via `--format svg` or by saving to a `.svg`-suffixed path with `--output`.
92
+ The output is a fully self-contained, interactive SVG file:
93
+ - **CSS hover highlight** — file tiles brighten and gain a soft glow; directory headers
94
+ brighten on mouse-over (`.tile` / `.dir-tile` classes, no JavaScript needed).
95
+ - **Floating tooltip panel** — a JavaScript-driven semi-transparent panel tracks the cursor
96
+ and shows the file or directory name, human-readable size, and file-type / item count.
97
+ No external scripts or stylesheets — the panel logic is embedded in the SVG itself.
98
+ - **Van Wijk cushion shading** — approximated via a single diagonal `linearGradient`
99
+ overlay (`gradientUnits="objectBoundingBox"`), defined once and shared across all tiles.
100
+ Matches the ×1.20 highlight / ×0.80 shadow range of the PNG renderer.
101
+ Disabled with `--no-cushion`.
102
+ - `--format png|svg` CLI option; format is also auto-detected from the `--output` file
103
+ extension.
104
+ - `create_treemap_svg()` added to the public Python API (`from dirplot import create_treemap_svg`).
105
+ - `drawsvg>=2.4` added as a core dependency.
106
+ - Rename the treemap command to `map` (dirplot map <root>).
107
+ - Add `termsize` subcommand and restructure CLI as multi-command app.
108
+ - Add `--depht` parameter to limit the scanning of large file trees.
109
+ - Support for SSH remote directory scanning (`pip install dirplot[ssh]`).
110
+ - Support for AWS S3 buckets in the cloud (`pip install dirplot[s3]`).
111
+ - Support for local archive files, .zip, tgz, .tar.xz, .rar, .7z, etc.
112
+ - Include example archives for 17 different extentions for testing.
113
+ - Comprehensive documentation.
114
+ - `github://owner/repo[@branch]` URI scheme for GitHub repository scanning. The old
115
+ `github:owner/repo` shorthand has been removed.
116
+ - File tiles now have a 1-px dark outline (60/255 below fill colour per channel) so
117
+ adjacent same-coloured tiles — e.g. a directory full of extension-less files — are
118
+ always visually distinct rather than blending into a single flat block.
119
+
120
+ ### Changed
121
+
122
+ - `docs/REMOTE-ACCESS.md` renamed to `docs/EXAMPLES.md`; Docker and Kubernetes pod
123
+ sections added; images with captions added for all remote backends.
124
+
125
+ ### Fixed
126
+
127
+ - SVG tooltips now show the original byte count when `--log` is active, not the
128
+ log-transformed layout value. `Node.original_size` is populated by `apply_log_sizes`
129
+ for both file and directory nodes and is used by the SVG renderer for `data-size`.
130
+ - GitHub error messages are now clear and actionable.
131
+
132
+ ## [0.2.0] - 2026-03-09
133
+
134
+ ### Added
135
+
136
+ - Support for Windows, incl. full test suite
137
+
138
+ ### Fixed
139
+
140
+ - Improved README, Makefile
141
+
142
+ ## [0.1.2] - 2026-03-06
143
+
144
+ ### Fixed
145
+
146
+ - Partly incorrect `uvx install dirplot` command
147
+ - Wrong version number in `uv.lock`
148
+
149
+ ## [0.1.1] - 2026-03-06
150
+
151
+ ### Fixed
152
+
153
+ - Typing complaints
154
+ - Improved README with better install/run commands
155
+
156
+ ## [0.1.0] - 2026-03-06
157
+
158
+ ### Added
159
+
160
+ - Nested squarified treemap rendered as a PNG at the exact pixel dimensions of the terminal window.
161
+ - Inline terminal display via iTerm2 and Kitty graphics protocols, auto-detected at runtime; supports iTerm2, WezTerm, Warp, Hyper, Kitty, and Ghostty.
162
+ - System-viewer fallback (`open` / `xdg-open`) as the default display mode.
163
+ - File-extension colours from the GitHub Linguist palette (~500 known extensions); unknown extensions fall back to a stable MD5-derived colour from the chosen colormap.
164
+ - Van Wijk quadratic cushion shading giving each tile a raised 3-D look (`--cushion`, on by default).
165
+ - Bundled JetBrains Mono fonts for crisp directory labels at any size.
166
+ - CLI options: `--output`, `--show/--no-show`, `--inline`, `--legend`, `--font-size`, `--colormap`, `--exclude`, `--size`, `--header/--no-header`, `--cushion/--no-cushion`, `--log`.
167
+ - Full test suite (65 tests), strict mypy, ruff linting, pre-commit hooks, and CI on Python 3.10–3.13.
@@ -0,0 +1,21 @@
1
+ FROM python:3.12-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Install build tools needed by some optional deps
6
+ RUN pip install --no-cache-dir uv
7
+
8
+ # Copy project metadata first for layer caching
9
+ COPY pyproject.toml README.md ./
10
+
11
+ # Copy source
12
+ COPY src/ src/
13
+
14
+ # Install dirplot with all extras
15
+ RUN uv pip install --system --no-cache ".[ssh,s3,docker,dev]"
16
+
17
+ # Copy the rest (tests, docs, etc.) so the container is a useful scan target
18
+ COPY . .
19
+
20
+ # Keep the container running so docker:// scanning works
21
+ CMD ["sleep", "infinity"]
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dirplot
3
- Version: 0.2.0
4
- Summary: Static treemap bitmaps for directory trees, displayed as inline terminal images
3
+ Version: 0.3.1
4
+ Summary: Static treemap bitmaps for directory trees and archives, displayed as inline terminal images
5
5
  Project-URL: Repository, https://github.com/deeplook/dirplot
6
6
  License: MIT
7
7
  License-File: LICENSE
@@ -19,13 +19,18 @@ Classifier: Programming Language :: Python :: 3.12
19
19
  Classifier: Programming Language :: Python :: 3.13
20
20
  Classifier: Programming Language :: Python :: 3.14
21
21
  Classifier: Topic :: Scientific/Engineering :: Visualization
22
+ Classifier: Topic :: System :: Archiving
22
23
  Classifier: Topic :: System :: Filesystems
23
24
  Classifier: Topic :: Terminals
24
25
  Classifier: Topic :: Utilities
25
26
  Classifier: Typing :: Typed
26
27
  Requires-Python: >=3.10
28
+ Requires-Dist: drawsvg>=2.4.1
29
+ Requires-Dist: libarchive-c>=5.0
27
30
  Requires-Dist: matplotlib>=3.7
28
31
  Requires-Dist: pillow>=9.0
32
+ Requires-Dist: py7zr>=0.20
33
+ Requires-Dist: rarfile>=4.0
29
34
  Requires-Dist: squarify>=0.4
30
35
  Requires-Dist: typer>=0.9
31
36
  Provides-Extra: dev
@@ -34,6 +39,12 @@ Requires-Dist: pre-commit>=3.0; extra == 'dev'
34
39
  Requires-Dist: pytest-cov>=5.0; extra == 'dev'
35
40
  Requires-Dist: pytest>=8.0; extra == 'dev'
36
41
  Requires-Dist: ruff>=0.4; extra == 'dev'
42
+ Provides-Extra: libarchive
43
+ Requires-Dist: libarchive-c>=5.3; extra == 'libarchive'
44
+ Provides-Extra: s3
45
+ Requires-Dist: boto3>=1.26; extra == 's3'
46
+ Provides-Extra: ssh
47
+ Requires-Dist: paramiko>=3.0; extra == 'ssh'
37
48
  Description-Content-Type: text/markdown
38
49
 
39
50
  # dirplot
@@ -58,10 +69,14 @@ Description-Content-Type: text/markdown
58
69
  - Label colour (black/white) chosen automatically based on background luminance.
59
70
  - Output resolution matches the current terminal window pixel size (via `TIOCGWINSZ`), or a custom `WIDTHxHEIGHT`.
60
71
  - Van Wijk cushion shading gives tiles a raised 3-D appearance (optional).
72
+ - **SVG output** (`--format svg` or `--output file.svg`) produces a fully self-contained interactive file: CSS hover highlight, a JavaScript floating tooltip panel, and cushion shading via a gradient — no external dependencies.
61
73
  - Display via system image viewer or inline in the terminal (iTerm2 and Kitty protocols, auto-detected).
62
- - Save output to a PNG file with `--output`.
74
+ - Save output to a PNG or SVG file with `--output`.
63
75
  - Exclude paths with `--exclude` (repeatable).
64
76
  - Works on macOS, Linux, and Windows; WSL2 fully supported.
77
+ - Scan remote hosts over SSH (`pip install "dirplot[ssh]"`), AWS S3 buckets (`pip install "dirplot[s3]"`), any public/private GitHub repository (including specific branch, tag, commit SHA, or subdirectory), **running Docker containers**, or **Kubernetes pods** — all without extra dependencies beyond the respective CLI/SDK. See [EXAMPLES.md](docs/EXAMPLES.md).
78
+ - Optional **file-count legend** (`--legend`) — a corner overlay listing the top extensions by number of files, with coloured swatches and counts, automatically sized to fit the image.
79
+ - **Wide archive support** — reads zip, tar (gz/bz2/xz/zst), 7z, rar, and via libarchive: iso, cpio, rpm, cab, lha/lzh, xar/pkg, a/ar, and all ZIP-based formats (jar, whl, apk, nupkg, vsix, ipa, …) as virtual directory trees without unpacking. Encrypted archives are handled gracefully: metadata-only reads work without a password for most formats; a password can be supplied with `--password` or entered interactively when needed.
65
80
 
66
81
  ## How It Works
67
82
 
@@ -105,35 +120,51 @@ This tool has been developed and tested on macOS and is CI-tested on Linux and W
105
120
  uvx dirplot --help
106
121
 
107
122
  # Show dirplot for the current directory (opens image in system viewer)
108
- dirplot .
123
+ dirplot map .
124
+
125
+ # Show current terminal size in characters and pixels
126
+ dirplot termsize
109
127
 
110
128
  # Save to a file without displaying
111
- dirplot . --output dirplot.png --no-show
129
+ dirplot map . --output dirplot.png --no-show
112
130
 
113
131
  # Display inline (protocol auto-detected: iTerm2, Kitty, Ghostty)
114
- dirplot . --inline
132
+ dirplot map . --inline
115
133
 
116
134
  # Exclude directories
117
- dirplot . --exclude .venv --exclude .git
135
+ dirplot map . --exclude .venv --exclude .git
118
136
 
119
137
  # Use a different colormap and larger directory labels
120
- dirplot . --colormap Set2 --font-size 18
138
+ dirplot map . --colormap Set2 --font-size 18
121
139
 
122
140
  # Render at a fixed resolution instead of terminal size
123
- dirplot . --size 1920x1080 --output dirplot.png --no-show
141
+ dirplot map . --size 1920x1080 --output dirplot.png --no-show
124
142
 
125
143
  # Don't apply cushion shading — makes tiles look flat
126
- dirplot . --no-cushion
144
+ dirplot map . --no-cushion
145
+
146
+ # Show a file-count legend (top 20 extensions by default)
147
+ dirplot map . --legend
148
+
149
+ # Show a file-count legend limited to 10 entries
150
+ dirplot map . --legend 10
151
+
152
+ # Save as an interactive SVG (hover highlight + floating tooltip)
153
+ dirplot map . --output treemap.svg --no-show
154
+
155
+ # Force SVG format explicitly
156
+ dirplot map . --format svg --output treemap.svg --no-show
127
157
  ```
128
158
 
129
159
  ### Options
130
160
 
131
161
  | Flag | Short | Default | Description |
132
162
  |---|---|---|---|
133
- | `--output` | `-o` | — | Save PNG to this path |
163
+ | `--output` | `-o` | — | Save to this path (PNG or SVG) |
164
+ | `--format` | `-f` | auto | Output format: `png` or `svg`. Auto-detected from `--output` extension |
134
165
  | `--show/--no-show` | | `--show` | Display the image after rendering |
135
- | `--inline` | | off | Display in terminal (protocol auto-detected) |
136
- | `--legend/--no-legend` | | `--no-legend` | Show file-extension colour legend |
166
+ | `--inline` | | off | Display in terminal (protocol auto-detected; PNG only) |
167
+ | `--legend [N]` | | off | Show file-count legend; `N` sets max entries (default: 20) |
137
168
  | `--font-size` | `-s` | `12` | Directory label font size in pixels |
138
169
  | `--colormap` | `-c` | `tab20` | Matplotlib colormap for unknown extensions |
139
170
  | `--exclude` | `-e` | — | Path to exclude (repeatable) |
@@ -141,6 +172,8 @@ dirplot . --no-cushion
141
172
  | `--header/--no-header` | | `--header` | Print info lines before rendering |
142
173
  | `--cushion/--no-cushion` | | `--cushion` | Apply van Wijk cushion shading for a raised 3-D look |
143
174
  | `--log/--no-log` | | `--no-log` | Use log of file sizes for layout, making small files more visible |
175
+ | `--password` | | — | Password for encrypted archives; prompted interactively if not supplied and needed |
176
+ | `--github-token` | | `$GITHUB_TOKEN` | GitHub personal access token for private repos or higher rate limits |
144
177
 
145
178
  ## Inline Display
146
179
 
@@ -159,30 +192,82 @@ The default mode (`--show`, no `--inline`) opens the PNG in the system viewer (`
159
192
 
160
193
  > **Windows note:** Common Windows shells (PowerShell, cmd, Git Bash) and terminal emulators (Windows Terminal, ConEmu) do not support any inline image protocol. `--inline` will silently produce no output in these environments. [WezTerm](https://wezfurlong.org/wezterm/) is currently the only mainstream Windows terminal emulator that supports inline image rendering (via the Kitty graphics protocol). WSL2 is treated as Linux and has full support.
161
194
 
195
+ > **Tip:** In terminals that support inline images (iTerm2, WezTerm, Kitty, etc.), the rendered image can often be dragged directly out of the terminal window and dropped into another application or saved to the desktop — no `--output` needed. This drag-and-drop behaviour is not guaranteed across all terminals.
196
+
162
197
  > **Note:** `--inline` does not work in AI coding assistants such as Claude Code, Cursor, or GitHub Copilot Chat. These tools intercept terminal output as plain text and do not implement any graphics protocol, so the escape sequences are either stripped or displayed as garbage. Use the default `--show` mode (system viewer) or `--output` to save the PNG to a file instead. Or use [Pi](https://pi.dev) where it is easily added as an extension.
163
198
 
199
+ ## Archives
200
+
201
+ dirplot can read local archive files without unpacking them — zip, tar (gz/bz2/xz/zst), 7z, rar, and many more via libarchive (iso, cpio, rpm, cab, lha, xar, and all ZIP-based formats like jar, whl, apk, nupkg, vsix, ipa). See [ARCHIVES.md](docs/ARCHIVES.md) for the full list, dependencies, and platform notes.
202
+
203
+ ```bash
204
+ dirplot map project.zip
205
+ dirplot map release.tar.gz --depth 2
206
+ dirplot map app.jar
207
+ ```
208
+
209
+ ## Remote Access
210
+
211
+ dirplot can scan SSH hosts, AWS S3 buckets, GitHub repositories, running Docker containers, and Kubernetes pods. See [EXAMPLES.md](docs/EXAMPLES.md) for full details.
212
+
213
+ ```bash
214
+ pip install "dirplot[ssh]" # SSH via paramiko
215
+ pip install "dirplot[s3]" # AWS S3 via boto3
216
+ # GitHub: no extra dependency needed
217
+ # Docker: only the docker CLI required
218
+ # Kubernetes: only kubectl required
219
+ ```
220
+
221
+ ```bash
222
+ dirplot map ssh://alice@prod.example.com/var/www
223
+ dirplot map s3://noaa-ghcn-pds --no-sign
224
+ dirplot map github://pallets/flask
225
+ dirplot map github://torvalds/linux@v6.12/Documentation
226
+ dirplot map docker://my-container:/app
227
+ dirplot map pod://my-pod:/app
228
+ dirplot map pod://my-pod@staging:/app
229
+ ```
230
+
231
+ ### GitHub authentication
232
+
233
+ Public repositories work without a token but are subject to GitHub's unauthenticated rate limit of **60 requests/hour**. A personal access token raises this to **5,000 requests/hour** and is required for private repositories.
234
+
235
+ Pass a token via the `--github-token` flag or the `GITHUB_TOKEN` environment variable:
236
+
237
+ ```bash
238
+ # via flag
239
+ dirplot map github://my-org/private-repo --github-token ghp_…
240
+
241
+ # via environment variable (also picked up automatically by the CLI)
242
+ export GITHUB_TOKEN=ghp_…
243
+ dirplot map github://my-org/private-repo
244
+ ```
245
+
246
+ To create a token: GitHub → Settings → Developer settings → Personal access tokens → Generate new token (see [GitHub's guide](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)). For read-only treemap access the `public_repo` scope (or no scope for public repos) is sufficient; add `repo` for private repositories.
247
+
164
248
  ## Python API
165
249
 
166
- The public API is small `build_tree`, `create_treemap`, and the display helpers:
250
+ > **Note:** The programmatic Python API is still evolving and may change between releases without notice. Pin a specific version if you depend on it. The CLI interface is stable.
251
+
252
+ The public API is small — `build_tree`, `create_treemap`, `create_treemap_svg`, and the display helpers:
167
253
 
168
254
  ```python
169
255
  from pathlib import Path
170
- from dirplot.scanner import build_tree
171
- from dirplot.render import create_treemap
256
+ from dirplot import build_tree, create_treemap, create_treemap_svg
172
257
 
173
- # Build the tree and render to a PNG in memory
174
258
  root = build_tree(Path("/path/to/project"))
175
- buf = create_treemap(root, width_px=1920, height_px=1080, colormap="tab20", cushion=True)
176
259
 
177
- # Save to disk
260
+ # PNG returns a BytesIO containing PNG bytes
261
+ buf = create_treemap(root, width_px=1920, height_px=1080, colormap="tab20", cushion=True)
178
262
  Path("treemap.png").write_bytes(buf.read())
179
263
 
180
- # In a Jupyter notebook: display inline as a cell output (no save needed)
181
- from PIL import Image
182
- Image.open(buf) # Jupyter renders PIL images automatically via _repr_png_()
264
+ # SVG returns a BytesIO containing UTF-8 SVG bytes
265
+ # Includes CSS hover highlight, a JS floating tooltip, and cushion gradient shading.
266
+ buf = create_treemap_svg(root, width_px=1920, height_px=1080, cushion=True)
267
+ Path("treemap.svg").write_bytes(buf.read())
183
268
  ```
184
269
 
185
- To open the result in the system image viewer or display it inline:
270
+ To open a PNG in the system image viewer or display it inline in the terminal:
186
271
 
187
272
  ```python
188
273
  from dirplot.display import display_window, display_inline
@@ -194,6 +279,14 @@ buf.seek(0)
194
279
  display_inline(buf) # inline in terminal (iTerm2 / Kitty / WezTerm)
195
280
  ```
196
281
 
282
+ In a Jupyter notebook, PNG output renders automatically via PIL:
283
+
284
+ ```python
285
+ from PIL import Image
286
+ buf = create_treemap(root, width_px=1280, height_px=720)
287
+ Image.open(buf) # Jupyter renders PIL images automatically via _repr_png_()
288
+ ```
289
+
197
290
  ## Development
198
291
 
199
292
  ```bash
@@ -20,10 +20,14 @@
20
20
  - Label colour (black/white) chosen automatically based on background luminance.
21
21
  - Output resolution matches the current terminal window pixel size (via `TIOCGWINSZ`), or a custom `WIDTHxHEIGHT`.
22
22
  - Van Wijk cushion shading gives tiles a raised 3-D appearance (optional).
23
+ - **SVG output** (`--format svg` or `--output file.svg`) produces a fully self-contained interactive file: CSS hover highlight, a JavaScript floating tooltip panel, and cushion shading via a gradient — no external dependencies.
23
24
  - Display via system image viewer or inline in the terminal (iTerm2 and Kitty protocols, auto-detected).
24
- - Save output to a PNG file with `--output`.
25
+ - Save output to a PNG or SVG file with `--output`.
25
26
  - Exclude paths with `--exclude` (repeatable).
26
27
  - Works on macOS, Linux, and Windows; WSL2 fully supported.
28
+ - Scan remote hosts over SSH (`pip install "dirplot[ssh]"`), AWS S3 buckets (`pip install "dirplot[s3]"`), any public/private GitHub repository (including specific branch, tag, commit SHA, or subdirectory), **running Docker containers**, or **Kubernetes pods** — all without extra dependencies beyond the respective CLI/SDK. See [EXAMPLES.md](docs/EXAMPLES.md).
29
+ - Optional **file-count legend** (`--legend`) — a corner overlay listing the top extensions by number of files, with coloured swatches and counts, automatically sized to fit the image.
30
+ - **Wide archive support** — reads zip, tar (gz/bz2/xz/zst), 7z, rar, and via libarchive: iso, cpio, rpm, cab, lha/lzh, xar/pkg, a/ar, and all ZIP-based formats (jar, whl, apk, nupkg, vsix, ipa, …) as virtual directory trees without unpacking. Encrypted archives are handled gracefully: metadata-only reads work without a password for most formats; a password can be supplied with `--password` or entered interactively when needed.
27
31
 
28
32
  ## How It Works
29
33
 
@@ -67,35 +71,51 @@ This tool has been developed and tested on macOS and is CI-tested on Linux and W
67
71
  uvx dirplot --help
68
72
 
69
73
  # Show dirplot for the current directory (opens image in system viewer)
70
- dirplot .
74
+ dirplot map .
75
+
76
+ # Show current terminal size in characters and pixels
77
+ dirplot termsize
71
78
 
72
79
  # Save to a file without displaying
73
- dirplot . --output dirplot.png --no-show
80
+ dirplot map . --output dirplot.png --no-show
74
81
 
75
82
  # Display inline (protocol auto-detected: iTerm2, Kitty, Ghostty)
76
- dirplot . --inline
83
+ dirplot map . --inline
77
84
 
78
85
  # Exclude directories
79
- dirplot . --exclude .venv --exclude .git
86
+ dirplot map . --exclude .venv --exclude .git
80
87
 
81
88
  # Use a different colormap and larger directory labels
82
- dirplot . --colormap Set2 --font-size 18
89
+ dirplot map . --colormap Set2 --font-size 18
83
90
 
84
91
  # Render at a fixed resolution instead of terminal size
85
- dirplot . --size 1920x1080 --output dirplot.png --no-show
92
+ dirplot map . --size 1920x1080 --output dirplot.png --no-show
86
93
 
87
94
  # Don't apply cushion shading — makes tiles look flat
88
- dirplot . --no-cushion
95
+ dirplot map . --no-cushion
96
+
97
+ # Show a file-count legend (top 20 extensions by default)
98
+ dirplot map . --legend
99
+
100
+ # Show a file-count legend limited to 10 entries
101
+ dirplot map . --legend 10
102
+
103
+ # Save as an interactive SVG (hover highlight + floating tooltip)
104
+ dirplot map . --output treemap.svg --no-show
105
+
106
+ # Force SVG format explicitly
107
+ dirplot map . --format svg --output treemap.svg --no-show
89
108
  ```
90
109
 
91
110
  ### Options
92
111
 
93
112
  | Flag | Short | Default | Description |
94
113
  |---|---|---|---|
95
- | `--output` | `-o` | — | Save PNG to this path |
114
+ | `--output` | `-o` | — | Save to this path (PNG or SVG) |
115
+ | `--format` | `-f` | auto | Output format: `png` or `svg`. Auto-detected from `--output` extension |
96
116
  | `--show/--no-show` | | `--show` | Display the image after rendering |
97
- | `--inline` | | off | Display in terminal (protocol auto-detected) |
98
- | `--legend/--no-legend` | | `--no-legend` | Show file-extension colour legend |
117
+ | `--inline` | | off | Display in terminal (protocol auto-detected; PNG only) |
118
+ | `--legend [N]` | | off | Show file-count legend; `N` sets max entries (default: 20) |
99
119
  | `--font-size` | `-s` | `12` | Directory label font size in pixels |
100
120
  | `--colormap` | `-c` | `tab20` | Matplotlib colormap for unknown extensions |
101
121
  | `--exclude` | `-e` | — | Path to exclude (repeatable) |
@@ -103,6 +123,8 @@ dirplot . --no-cushion
103
123
  | `--header/--no-header` | | `--header` | Print info lines before rendering |
104
124
  | `--cushion/--no-cushion` | | `--cushion` | Apply van Wijk cushion shading for a raised 3-D look |
105
125
  | `--log/--no-log` | | `--no-log` | Use log of file sizes for layout, making small files more visible |
126
+ | `--password` | | — | Password for encrypted archives; prompted interactively if not supplied and needed |
127
+ | `--github-token` | | `$GITHUB_TOKEN` | GitHub personal access token for private repos or higher rate limits |
106
128
 
107
129
  ## Inline Display
108
130
 
@@ -121,30 +143,82 @@ The default mode (`--show`, no `--inline`) opens the PNG in the system viewer (`
121
143
 
122
144
  > **Windows note:** Common Windows shells (PowerShell, cmd, Git Bash) and terminal emulators (Windows Terminal, ConEmu) do not support any inline image protocol. `--inline` will silently produce no output in these environments. [WezTerm](https://wezfurlong.org/wezterm/) is currently the only mainstream Windows terminal emulator that supports inline image rendering (via the Kitty graphics protocol). WSL2 is treated as Linux and has full support.
123
145
 
146
+ > **Tip:** In terminals that support inline images (iTerm2, WezTerm, Kitty, etc.), the rendered image can often be dragged directly out of the terminal window and dropped into another application or saved to the desktop — no `--output` needed. This drag-and-drop behaviour is not guaranteed across all terminals.
147
+
124
148
  > **Note:** `--inline` does not work in AI coding assistants such as Claude Code, Cursor, or GitHub Copilot Chat. These tools intercept terminal output as plain text and do not implement any graphics protocol, so the escape sequences are either stripped or displayed as garbage. Use the default `--show` mode (system viewer) or `--output` to save the PNG to a file instead. Or use [Pi](https://pi.dev) where it is easily added as an extension.
125
149
 
150
+ ## Archives
151
+
152
+ dirplot can read local archive files without unpacking them — zip, tar (gz/bz2/xz/zst), 7z, rar, and many more via libarchive (iso, cpio, rpm, cab, lha, xar, and all ZIP-based formats like jar, whl, apk, nupkg, vsix, ipa). See [ARCHIVES.md](docs/ARCHIVES.md) for the full list, dependencies, and platform notes.
153
+
154
+ ```bash
155
+ dirplot map project.zip
156
+ dirplot map release.tar.gz --depth 2
157
+ dirplot map app.jar
158
+ ```
159
+
160
+ ## Remote Access
161
+
162
+ dirplot can scan SSH hosts, AWS S3 buckets, GitHub repositories, running Docker containers, and Kubernetes pods. See [EXAMPLES.md](docs/EXAMPLES.md) for full details.
163
+
164
+ ```bash
165
+ pip install "dirplot[ssh]" # SSH via paramiko
166
+ pip install "dirplot[s3]" # AWS S3 via boto3
167
+ # GitHub: no extra dependency needed
168
+ # Docker: only the docker CLI required
169
+ # Kubernetes: only kubectl required
170
+ ```
171
+
172
+ ```bash
173
+ dirplot map ssh://alice@prod.example.com/var/www
174
+ dirplot map s3://noaa-ghcn-pds --no-sign
175
+ dirplot map github://pallets/flask
176
+ dirplot map github://torvalds/linux@v6.12/Documentation
177
+ dirplot map docker://my-container:/app
178
+ dirplot map pod://my-pod:/app
179
+ dirplot map pod://my-pod@staging:/app
180
+ ```
181
+
182
+ ### GitHub authentication
183
+
184
+ Public repositories work without a token but are subject to GitHub's unauthenticated rate limit of **60 requests/hour**. A personal access token raises this to **5,000 requests/hour** and is required for private repositories.
185
+
186
+ Pass a token via the `--github-token` flag or the `GITHUB_TOKEN` environment variable:
187
+
188
+ ```bash
189
+ # via flag
190
+ dirplot map github://my-org/private-repo --github-token ghp_…
191
+
192
+ # via environment variable (also picked up automatically by the CLI)
193
+ export GITHUB_TOKEN=ghp_…
194
+ dirplot map github://my-org/private-repo
195
+ ```
196
+
197
+ To create a token: GitHub → Settings → Developer settings → Personal access tokens → Generate new token (see [GitHub's guide](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)). For read-only treemap access the `public_repo` scope (or no scope for public repos) is sufficient; add `repo` for private repositories.
198
+
126
199
  ## Python API
127
200
 
128
- The public API is small `build_tree`, `create_treemap`, and the display helpers:
201
+ > **Note:** The programmatic Python API is still evolving and may change between releases without notice. Pin a specific version if you depend on it. The CLI interface is stable.
202
+
203
+ The public API is small — `build_tree`, `create_treemap`, `create_treemap_svg`, and the display helpers:
129
204
 
130
205
  ```python
131
206
  from pathlib import Path
132
- from dirplot.scanner import build_tree
133
- from dirplot.render import create_treemap
207
+ from dirplot import build_tree, create_treemap, create_treemap_svg
134
208
 
135
- # Build the tree and render to a PNG in memory
136
209
  root = build_tree(Path("/path/to/project"))
137
- buf = create_treemap(root, width_px=1920, height_px=1080, colormap="tab20", cushion=True)
138
210
 
139
- # Save to disk
211
+ # PNG returns a BytesIO containing PNG bytes
212
+ buf = create_treemap(root, width_px=1920, height_px=1080, colormap="tab20", cushion=True)
140
213
  Path("treemap.png").write_bytes(buf.read())
141
214
 
142
- # In a Jupyter notebook: display inline as a cell output (no save needed)
143
- from PIL import Image
144
- Image.open(buf) # Jupyter renders PIL images automatically via _repr_png_()
215
+ # SVG returns a BytesIO containing UTF-8 SVG bytes
216
+ # Includes CSS hover highlight, a JS floating tooltip, and cushion gradient shading.
217
+ buf = create_treemap_svg(root, width_px=1920, height_px=1080, cushion=True)
218
+ Path("treemap.svg").write_bytes(buf.read())
145
219
  ```
146
220
 
147
- To open the result in the system image viewer or display it inline:
221
+ To open a PNG in the system image viewer or display it inline in the terminal:
148
222
 
149
223
  ```python
150
224
  from dirplot.display import display_window, display_inline
@@ -156,6 +230,14 @@ buf.seek(0)
156
230
  display_inline(buf) # inline in terminal (iTerm2 / Kitty / WezTerm)
157
231
  ```
158
232
 
233
+ In a Jupyter notebook, PNG output renders automatically via PIL:
234
+
235
+ ```python
236
+ from PIL import Image
237
+ buf = create_treemap(root, width_px=1280, height_px=720)
238
+ Image.open(buf) # Jupyter renders PIL images automatically via _repr_png_()
239
+ ```
240
+
159
241
  ## Development
160
242
 
161
243
  ```bash
@@ -4,7 +4,7 @@
4
4
 
5
5
  | Version | Supported |
6
6
  |---------|--------------------|
7
- | 0.1.x | :white_check_mark: |
7
+ | 0.3.x | :white_check_mark: |
8
8
 
9
9
  ## Reporting a Vulnerability
10
10