Files
skillshare/cmd
Willie ce7c7d154d fix(list): group TUI entries by tracked repo root and local top dir
The list TUI had two grouping bugs:

1. Local nested skills (e.g. mma/agent-browser, mma/docker-expert) were
   lumped into the "standalone" group because buildGroupedItems keyed on
   RepoName, which is empty for non-tracked skills.

2. Agents deep inside a tracked repo (e.g. _vijay-agents/agents/core/x.md,
   _vijay-agents/agents/specialized/python/y.md) were split into separate
   groups per sub-directory. discoverAndBuildAgentEntries set RepoName to
   filepath.Dir(RelPath), producing keys like '_vijay-agents/agents/core'
   instead of the tracked repo root.

Fix:

- discoverAndBuildAgentEntries now uses d.RepoRelPath (already computed
  by agent discovery) so tracked agents share one visual group regardless
  of nesting depth. This also corrects a pre-existing mis-count where
  local nested agents were counted as tracked in the summary footer.

- Add skillTopGroup() helper in list_tui_filter.go: tracked → RepoName;
  non-tracked nested → first RelPath segment; flat → "" (standalone).

- buildGroupedItems now keys on skillTopGroup() so local nested groups
  (mma/*) render as their own bucket instead of standalone.

- sortSkillEntries default sort now groups by top-level bucket first,
  placing standalone last, so buildGroupedItems sees contiguous blocks.

- Remove 'if opts.SortBy != ""' gating in both global list paths: sort
  must always run to guarantee the TUI grouping invariant.

Tests: 4 new unit tests cover local nested grouping, deep tracked agents,
skillTopGroup cases, and the top-group-aware sort order.
2026-04-10 19:00:33 +08:00
..