claude-sessions: skip profile dirs with no profile part
This commit is contained in:
@@ -14,7 +14,7 @@ Python script (`scripts/claude-sessions`, symlinked to `~/sbin/`). Manages Claud
|
|||||||
- **Location column.** Live and resumable rows show the session folder (`~` for `$HOME`). Live rows take it from the registry (`project_dir`), falling back to tmux `#{session_path}`.
|
- **Location column.** Live and resumable rows show the session folder (`~` for `$HOME`). Live rows take it from the registry (`project_dir`), falling back to tmux `#{session_path}`.
|
||||||
- **`n` New session.** Asks for a folder: Enter accepts the nearest `CLAUDE.md` folder, `b` opens the folder browser, or type a project name/path (same lookup as `claude-tmux`).
|
- **`n` New session.** Asks for a folder: Enter accepts the nearest `CLAUDE.md` folder, `b` opens the folder browser, or type a project name/path (same lookup as `claude-tmux`).
|
||||||
- **Folder browser.** `zenity --file-selection --directory` when `DISPLAY`/`WAYLAND_DISPLAY` is set and zenity exists (has Create Folder). Otherwise a terminal browser: number = open, `u` up, `n` new folder, `/text` filter, `>` `<` page, `h` hidden, `~`/`/path` jump, Enter/`s` select, `q` cancel.
|
- **Folder browser.** `zenity --file-selection --directory` when `DISPLAY`/`WAYLAND_DISPLAY` is set and zenity exists (has Create Folder). Otherwise a terminal browser: number = open, `u` up, `n` new folder, `/text` filter, `>` `<` page, `h` hidden, `~`/`/path` jump, Enter/`s` select, `q` cancel.
|
||||||
- **Profile.** After the topic, a numbered picker lists every `~/.claude-[company]-[profile]` dir that has a `projects/` folder, shown as `Company (profile)` (e.g. `O'Reilly IT (anthropic)`). A dir with no profile part shows `(base)`; `~/.claude` shows `Personal (main)`. Company names come from `profiles.yaml` `display_name` (parenthetical stripped), else the Title-Cased segment. Enter accepts `oreillyit-anthropic`. The choice is passed as `--profile` to `claude-tmux`.
|
- **Profile.** After the topic, a numbered picker lists every `~/.claude-[company]-[profile]` dir that has a `projects/` folder, shown as `Company (profile)` (e.g. `O'Reilly IT (anthropic)`). A dir with no profile part (`~/.claude-octopus`) is skipped; `~/.claude` shows `Personal (main)`. Company names come from `profiles.yaml` `display_name` (parenthetical stripped), else the Title-Cased segment. Enter accepts `oreillyit-anthropic`. The choice is passed as `--profile` to `claude-tmux`.
|
||||||
- **Topic.** Becomes the tmux session name and the Remote Control name (passed as `--name` to `claude-tmux`). Defaults to the Title-Cased folder name. If that name is already a live tmux session, no default is offered and a unique topic is required. Topics containing `.` or `:` are rejected because tmux rewrites them to `_`.
|
- **Topic.** Becomes the tmux session name and the Remote Control name (passed as `--name` to `claude-tmux`). Defaults to the Title-Cased folder name. If that name is already a live tmux session, no default is offered and a unique topic is required. Topics containing `.` or `:` are rejected because tmux rewrites them to `_`.
|
||||||
|
|
||||||
## Headless spawn
|
## Headless spawn
|
||||||
|
|||||||
@@ -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]]:
|
def discover_profile_choices(profiles_cfg: dict) -> list[tuple[str, str]]:
|
||||||
"""Profiles from ~/.claude-[company]-[profile] dirs as (name, "Company (profile)").
|
"""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,
|
come from profiles.yaml display_name (parenthetical stripped) when known,
|
||||||
otherwise the Title-Cased directory segment. ~/.claude is the "default" profile.
|
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
|
continue
|
||||||
name = d.name[len(".claude-"):]
|
name = d.name[len(".claude-"):]
|
||||||
company, _, variant = name.partition("-")
|
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))
|
choices.append((name, label))
|
||||||
if (HOME / ".claude" / "projects").is_dir():
|
if (HOME / ".claude" / "projects").is_dir():
|
||||||
choices.append(("default", "Personal (main)"))
|
choices.append(("default", "Personal (main)"))
|
||||||
|
|||||||
Reference in New Issue
Block a user