microsoft / microsoft/winml-cli
feat(cache): add `wmk cache` CLI command group (list, clear, info)
Open
@tezheng is already working on this.
Since Mar 31, 2026.
dev experience
feature scale
P1
triaged
- Dominant language
- Python
- Stars
- 40
- Forks
- 11
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 50
Description
Summary
The cache module (modelkit/cache/) has well-designed primitives (list_cached_models(), get_cache_dir(), etc.) but no CLI entrypoint. Users cannot inspect or manage the cache without manually navigating ~/.cache/winml/.
Motivation
list_cached_models()is exported and tested but completely unreachable from the CLI- Users need visibility into what's cached, how much space it uses, and the ability to clean up
- Common developer workflow: export → inspect cache → clear stale artifacts
Proposed Subcommands
wmk cache list
- Uses
list_cached_models()directly - Groups by model slug, shows task/stage/size
- Rich Table output (default) or JSON (
--format json) --modelfilter by model slug
wmk cache clear
wmk cache clear— clear all (with confirmation prompt)wmk cache clear --model <slug>— clear specific model--yesflag to skip confirmation- Shows what was deleted and freed space
wmk cache info
- Shows cache directory path
- Total size, number of models, number of artifacts
- Environment variable status (
WMK_CACHE_DIR)
Implementation Plan
| File | Action | Description |
|---|---|---|
modelkit/cache/model.py |
Modify | Add clear_cache() and clear_model_cache() functions |
modelkit/commands/cache.py |
Create | New CLI command group with 3 subcommands |
tests/commands/test_cache_cli.py |
Create | CLI tests for all subcommands |
tests/cache/test_model.py |
Modify | Unit tests for new clear functions |
Patterns to Reuse
- Rich Table pattern from
modelkit/commands/sys.py - Click CliRunner from existing test files
click.confirm()for deletion confirmation- Auto-discovery in
cli.pyfor command registration
Acceptance Criteria
-
wmk cache listdisplays cached models in table format -
wmk cache list --format jsonoutputs JSON -
wmk cache list --model <slug>filters output -
wmk cache clear --yesremoves all cache artifacts -
wmk cache clear --model <slug> --yesremoves specific model -
wmk cache infoshows cache path, size, and model count - All new code has pytest coverage
-
uv run ruff checkpasses on all modified files
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.