Set Session Context
Automatically set session name and color based on the current git branch and PR.
Steps
Detect branch:
git symbolic-ref --short HEAD- If detached HEAD (command fails) → stop, do nothing
- If
mainormaster→ stop, do nothing
Look up PR title:
gh pr view --json title --jq '.title'Determine session name:
- If PR exists → use PR title
- If no PR → humanize branch name: strip the conventional prefix and slash/hyphen separator, replace remaining hyphens with spaces
feat/add-widget→add widgetfix-login-bug→login bug
Run:
/rename <session name>Determine color from the branch prefix (match
^(type)[/-]):Prefix Color featblue fixred choregreen docscyan refactoryellow testpurple ciorange buildorange perfyellow stylecyan (no match) blue Run:
/color <color>
Behavior
- Execute silently: do not announce, explain, or narrate what you are doing.
- Do not ask for confirmation.
- If
ghis unavailable or fails, fall back to the humanized branch name.