claude-sessions: skip profile dirs with no profile part

This commit is contained in:
Paul O'Reilly
2026-10-27 16:57:48 +13:00
parent a9e425a29b
commit 2b3b4e2783
2 changed files with 6 additions and 3 deletions

View File

@@ -351,7 +351,8 @@ def prompt_topic(folder: Path, live: set[str]) -> Optional[str]:
def discover_profile_choices(profiles_cfg: dict) -> list[tuple[str, str]]:
"""Profiles from ~/.claude-[company]-[profile] dirs as (name, "Company (profile)").
A dir counts as a profile if it has a projects/ folder. Company display names
A dir counts as a profile if it has a projects/ folder and a profile part
(~/.claude-[company] alone is skipped). Company display names
come from profiles.yaml display_name (parenthetical stripped) when known,
otherwise the Title-Cased directory segment. ~/.claude is the "default" profile.
"""
@@ -369,7 +370,9 @@ def discover_profile_choices(profiles_cfg: dict) -> list[tuple[str, str]]:
continue
name = d.name[len(".claude-"):]
company, _, variant = name.partition("-")
label = f"{company_names.get(company) or title_case(company)} ({variant or 'base'})"
if not variant:
continue
label = f"{company_names.get(company) or title_case(company)} ({variant})"
choices.append((name, label))
if (HOME / ".claude" / "projects").is_dir():
choices.append(("default", "Personal (main)"))