Repository navigation
dsh-huggingface: the Hub as a surface over the machine's own hf CLI and cache - #18
Merged
Merged
Conversation
…nd cache A new host-only bundle, five tools and two skills, that answers the question a person asks before committing disk and bandwidth: what does this repo weigh, and do I already have it? - hf_status: the cache root through the library's own precedence, every repo with byte-exact sizes, and the split between complete repos and metadata-only stubs. Auth is reported as a presence; the token is never read, echoed or accepted. - hf_repo: licence, gated flag, architecture, weight with its measure named, the files each consumer would fetch, and the local verdict (complete / stub / stale / absent). - hf_cache: list without any CLI, plus verify / prune / rm - an unconfirmed removal is the CLI's own --dry-run, rm needs the repo id repeated back. - hf_download: the only bytes-moving call; a byte ceiling, then `confirm`, then the bytes the cache actually GAINED. - hf_search: ranked ids with the flags a download needs. Three measured facts shaped the design: the CLI's JSON reports "17.9G" and "3 months ago" rather than bytes and timestamps, so sizes come from the tree; blobs are hash-named, so weights are detected from snapshot names and only ONE side of the layout is summed; and this CLI line has no per-file sizes, so the repo weight is used_storage and a narrowed selection says it is unmeasured instead of inventing a number. On the machine that wrote this: 49 repos / 19.8 GB cached, 42 of them metadata only, and hf 1.26.1. Checks: node checks/check-huggingface-node.mjs (217), check-node-routes, check-no-secrets, check-scripts - all pass.
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.
What this adds
dsh-huggingface— a host-only bundle with five tools and two skills overthe machine's own
hfCLI (huggingface_hub 1.26.1 here) and the cache on disk.It answers the question a person asks before committing disk and bandwidth:
what does this repo weigh, and do I already have it?
hf_statushf_repohf_cachelistwith no CLI at all, plusverify/prune/rm— an unconfirmed removal is the CLI's own--dry-run,rmneeds the repo id repeated backhf_downloadconfirm, then the bytes the cache actually gainedhf_searchSkills:
huggingface-hub(the v1hfcommand set, revisions, gated repos,hf://, the JSON contract, the raw API) andhuggingface-cache(theblobs/snapshots/refslayout, cached-vs-complete, verify/prune/rm, moving thecache, the Windows link-vs-copy trap).
Three measured findings shaped the design
hf cache ls --jsonanswers"size": "17.9G"and"last_accessed": "3 months ago". Byte-exact numberstherefore come from walking the directory tree, not from parsing a screen.
test against
blobs/9f3c…calls every canonical POSIX repo weightless, andsumming blobs and snapshots doubles a cache. Weights are detected from
snapshot names, and exactly one side is summed — the snapshot side on a
machine where Xet wrote copies and
blobs/is empty.--expand siblingscarriesrfilenameonly and there is no--blobsflag, so the repo weight isused_storage, labelled as such; a narrowed selection says it is unmeasuredinstead of inventing a number.
On the machine that wrote this: 49 repos / 19.8 GB cached, 42 of them
metadata only — a fact no directory listing shows and the reason the row earns
its place.
Verification
The package check needs no network and touches no real cache: the cache is a
fixture tree in a temp dir (including the double-count and no-blobs layouts), and
the CLI is a fake runner that records the exact argv — which is how the
-y/--dry-rundecisions and the "no download over the ceiling" rule are assertedrather than hoped for. A download in the check writes real bytes, so
addedBytesis measured. Live verification against the real CLI is in the package README.
Also: the root README/ARCHITECTURE rows, the
.dsh-version.jsonentry, and thebanner (
35 plugins, 59 skills.— the counts moved by this bundle, 33 → 35 and51 → 59 counting
dsh-comfyui's six skills that merged after the last banner).Not in this PR
Image generation, uploading, repo creation/deletion, reading or accepting a
token, and running the CLI's own updater.