Skip to content

Add filtering to kit list #1091

@gorkem

Description

@gorkem

Problem

kit list currently returns every ModelKit in local storage (or every tag in a remote repository) with no way to narrow results. As ModelKit usage expands beyond ML models to include agent skills, prompt libraries, datasets, and code packages, the unfiltered flat list becomes increasingly hard to work with.

The only "filtering" today is targeting a specific remote repository as a positional argument. There is no way to filter by what a ModelKit contains.

Proposed Solution

Add a --filter / -f flag to kit list using the same syntax and semantics as the existing kit unpack --filter flag.

Filter syntax

--filter <type>[,<type>][:<name>[,<name>]]

Where <type> is one of the valid Kitfile content types (model, datasets, code, docs, prompts) and <name> is an optional comma-separated list matched against the layer's name or path.

This is identical to kit unpack --filter. The same ParseFilter function and FilterConf struct from pkg/lib/filesystem/unpack/filter.go should be reused (or extracted to a shared location).

Behavior

  • -f can be specified multiple times; a ModelKit is listed if it matches any filter (OR logic across filters, consistent with kit unpack)
  • Within a single filter, type and name conditions are AND-ed (consistent with kit unpack)
  • If no filters are specified, all ModelKits are listed (current default behavior)
  • A ModelKit matches a filter if its Kitfile contains at least one layer matching the filter
  • Works for both local and remote listings
  • Compatible with all output formats (--format table, --format json, Go templates)

Example usage

# List only ModelKits that contain prompt layers
kit list -f prompts

# List only ModelKits containing a model
kit list -f model

# List ModelKits that have either prompts or datasets
kit list -f prompts -f datasets

# List ModelKits with a specific named prompt
kit list -f prompts:pdf-processing

Implementation notes

The core filter parsing and matching logic already exists in pkg/lib/filesystem/unpack/filter.go.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions