microsoft / microsoft/winml-cli

feat(cache): add `wmk cache` CLI command group (list, clear, info)

Open
#82 1 comment 0 reactions 1 assignee View on GitHub

@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)
  • --model filter by model slug
wmk cache clear
  • wmk cache clear — clear all (with confirmation prompt)
  • wmk cache clear --model <slug> — clear specific model
  • --yes flag 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.py for command registration

Acceptance Criteria

  • wmk cache list displays cached models in table format
  • wmk cache list --format json outputs JSON
  • wmk cache list --model <slug> filters output
  • wmk cache clear --yes removes all cache artifacts
  • wmk cache clear --model <slug> --yes removes specific model
  • wmk cache info shows cache path, size, and model count
  • All new code has pytest coverage
  • uv run ruff check passes on all modified files

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.