Repository navigation
feat(ls): add 'dt list' and a tracked-object tree with md/html export (0.26.0) - #189
Merged
Merged
Conversation
… (0.26.0) Adds `dt list` as an alias for `dt ls`, and a `--tree` mode that renders the repository as a nested tree in three formats: plain text, Markdown, and a self-contained interactive HTML page. Tree scope (the tracked-object view): - Default shows git-tracked + DVC-tracked objects only. - `--all` also includes untracked files (never git-/dvc-ignored ones). - `--dvc-only` restricts to DVC outputs; `-L/--level N` caps depth. - Excludes untracked, git-ignored, and dvc-ignored paths, plus DVC/VCS bookkeeping (`*.dvc`, `dvc.lock`, `.gitignore`, `.dvcignore`, `.dvc/`, `.dt/`) -- the tracked object is shown, not the pointer/config. DVC data is always shown even though it is gitignored (matched via `isout`). - A remote URL or a committed `--rev` is treated as an already-tracked tree. Rendering: - Text/Markdown print the repo name and revision (short SHA, tags, date). - HTML titles the repo linked to its web page, shows the revision subtitle, and reuses the collapsible fold-up from `dt diff -o html`. Each node has a popup of copy-pastable `dvc get`/`dvc import` commands with HTTPS/SSH tabs (default HTTPS, remembered); both clone URLs are derived from the repo so SSH works for private repos. Performance: `dt ls`/`dt list` no longer request `--size`/`--show-hash` from `dvc list` unless a flag or filter needs them, keeping dvc off its heavy, mmap-intensive resolution path on large (100k+ file) trees; subtree counts are memoized so HTML rendering is linear. Docs updated (docs/ls.md, docs/commands.md). Unit + integration tests added. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
In the HTML tree, git-tracked files (isout=False) now render as direct links
to their GitHub blob, pinned to the listed revision's SHA -- handy for opening
a README straight from the tree. DVC-tracked objects are unchanged: their data
isn't on the git host, so they keep the dvc get/import popup. Directories keep
the popup too.
File entries in the tree now carry the per-file blob URL (build_tree stores
{name, gh}); _annotate_github computes it for HTML output only, skipping
untracked files (reachable only via --all) which aren't on the host. Falls
back to the popup when the repo has no browsable web URL.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
dt list(an alias fordt ls) and a--treemode that renders the repository as a nested tree in three formats — plain text, Markdown, and a self-contained interactive HTML page.Tree scope — the tracked-object view
By default the tree shows the git-tracked + DVC-tracked objects and nothing else:
--all);.snakemake/,__pycache__/, …);*.dvcpointers,dvc.lock,.gitignore,.dvcignore, and the.dvc/and.dt/directories. The tracked object is shown, not the file that points at or configures it.DVC-tracked data is always shown even though DVC keeps it under
.gitignore(matched viaisout).dvc listalready honours.dvcignore, so dvc-ignored paths never appear.--tree-o {text,md,html}md/htmlimply--tree)--all--dvc-only-L, --level N… (N files)A remote
URLor a committed--revis treated as an already-tracked tree (only bookkeeping is stripped).Rendering
dt diff -o html(per-directory<details>, Expand/Collapse all).README) is a direct link to its blob on the repo's web page, pinned to the listed revision's SHA. Browse docs straight from the tree.dvcbutton opens copy-pastabledvc get/dvc importcommands with HTTPS / SSH tabs (default HTTPS, remembered across popups). Both clone URLs are derived from the repo, so SSH works for private repos. (Directories offer the same popup.)Performance
dt ls/dt listno longer askdvc listfor--size/--show-hashunless a flag or filter needs them, keeping dvc off its heavy, mmap-intensive resolution path on large (100k+ file) trees. Subtree counts are memoized so HTML rendering is linear in the number of nodes.Docs
docs/ls.md— new Tree view section (scope, options, formats, HTML features incl. GitHub links) + alias note.docs/commands.md— updateddt lsentry.Tests
tests/unit/test_ls.py): tree build/render (text/md/html), depth collapse, the tracked/--all/--dvc-onlyfiltering model, bookkeeping/.dvc/.dtsuppression, repo-URL parsing (HTTPS/SSH), popup contents, the revision subtitle, and git-file-to-GitHub linking (+ no-web-URL fallback).tests/integration/test_ls_cmd.py):dt listalias parity, tree formats against a real DVC repo, default excludes untracked/ignored/bookkeeping,--allre-includes untracked, HTML repo-link + popup, git-tracked files link to GitHub while DVC objects keep the popup, and the revision/tag subtitle.All unit tests pass locally (90) and the full
lsintegration suite passes on an NCI compute node (25).🤖 Generated with Claude Code