feat(vendor): --exclude plus content-type selection (--types/--exclude-types)

vendor add gains --exclude a,b,c (all mode minus those ids) as the mirror
of --include, for taking the majority of a source while dropping a few
items. Mutual exclusion with --include is a hard error, unknown ids fail
naming the available ones (generalized checkIDEntries).

vendor add and vendor select gain --types (allow-list) and --exclude-types
(deny-list) over the four content types. The filter is stored as the
optional, v2-compatible Selection.exclude_types field and survives vendor
update: new upstream items of an excluded type never enter the work
repository (unlike id expansion, which would silently re-admit them).
--types/--exclude-types replace the filter on select, absent flags keep
it, and --mode all clears it along with include/exclude.

Also fixes materializeTree to create the staging directory for an empty
selection — previously select-to-zero failed at the staging rename.
This commit is contained in:
m3ta-chiron committed 2026-10-02 12:35:39 +02:00
1 parent 1ab97bff43
commit 0c779bc970
9 files changed
+533 -50

No files matched your search

+9 -4
View File
@@ -68,11 +68,15 @@ const (
)
// Selection expresses what enters the work repository: everything minus
// Exclude (mode all), or exactly Include (mode include).
// Exclude (mode all), or exactly Include (mode include). ExcludeTypes
// filters whole content types (skills, commands, agents, mcp) on top of
// either mode and survives updates: new upstream items of an excluded
// type never enter the work repository.
type Selection struct {
Mode SelectionMode `json:"mode"`
Exclude []string `json:"exclude,omitempty"`
Include []string `json:"include,omitempty"`
Mode SelectionMode `json:"mode"`
Exclude []string `json:"exclude,omitempty"`
Include []string `json:"include,omitempty"`
ExcludeTypes []string `json:"exclude_types,omitempty"`
}
// Source pins one vendored git source.
@@ -140,6 +144,7 @@ func (l *Lockfile) Save(path string) error {
for _, src := range l.Sources {
sort.Strings(src.Selection.Exclude)
sort.Strings(src.Selection.Include)
sort.Strings(src.Selection.ExcludeTypes)
sort.Strings(src.Warnings)
for _, items := range src.Inventory {
sort.Strings(items)