Skip to content

feat: account aliases + fix Pro/Max plan detection#1

Open
vvedantb wants to merge 1 commit into
Leuconoe:mainfrom
vvedantb:feat/account-aliases-and-plan-detection
Open

feat: account aliases + fix Pro/Max plan detection#1
vvedantb wants to merge 1 commit into
Leuconoe:mainfrom
vvedantb:feat/account-aliases-and-plan-detection

Conversation

@vvedantb
Copy link
Copy Markdown

Summary

Two related improvements for users who manage multiple Claude accounts:

1. Fix: Pro/Max plan misdetection

inferPlanType only special-cased team/enterprise subscriptionType, then fell back to an org-scope heuristic. A Pro account whose user is an admin of their own org (organizationRole: "admin") hit that heuristic and was mislabeled "Teams".

The OAuth subscriptionType is the authoritative signal, so pro/max are now honored before the heuristic:

if (subscriptionType === 'enterprise') return 'Enterprise';
if (subscriptionType === 'pro') return 'Pro';
if (subscriptionType === 'max') return 'Max';

2. Feature: custom account aliases (--rename)

When several stored accounts share the same Claude display name (e.g. the same person's work + personal accounts), the list is ambiguous — every row shows the same name. There was no built-in way to label them, and hand-editing the store JSON didn't survive because syncStoreFromLive overwrites metadata wholesale on each sync.

This adds:

  • cc-switch --rename <index> <name> (also rename) — sets entry.alias. Omit <name> to clear it. Multi-word names work without quoting.
  • getEntryLabel(entry) — prefers entry.alias, falling back to the account's display name. Used in list, switch, and remove output.
  • syncStoreFromLive now preserves alias across syncs (alongside lastUsedAt/usageSnapshot), so the label is stable.

cli.cjs needs no change — its switch command already forwards extra args through to cc-switch.cjs.

Example

$ cc-switch --rename 1 Personal
Renamed account: [1] Personal <me@example.com>

Stored account list:
  [0] Work     | Team Prem | 5H:94% (~2h 3min) | 7D:99% (6D 3h) | used:8m ago
* [1] Personal | Pro       | 5H:88% (~4h 43min) | 7D:98% (6D 14h) | used:6m ago

$ cc-switch --rename 1        # clears the alias, reverts to display name

Testing

  • node --check on all modified files.
  • Functional run against an isolated store copy: set alias, multi-word alias without quotes, clear alias (reverts to display name), and confirmed a Pro account with organizationRole: admin now reports Pro instead of Teams. Alias persists across --sync.

Files changed

  • lib/output/accounts.cjspro/max detection + getEntryLabel
  • lib/store/accounts.cjs — preserve alias on sync
  • lib/actions/rename.cjs — new action
  • lib/actions/switch.cjs, lib/actions/remove.cjs — use getEntryLabel
  • cc-switch.cjs — wire --rename action and arg parsing
  • README.md — document the flag

Adds a `cc-switch --rename <index> <name>` command to set a custom label
for a stored account, and fixes a plan-detection bug.

Plan detection:
- inferPlanType only special-cased `team`/`enterprise` subscriptionType, then
  fell back to an org-scope heuristic. A Pro account whose user is an org admin
  (organizationRole) was misreported as "Teams". Now `pro`/`max` subscriptionType
  is honored before the heuristic, so it correctly reports "Pro"/"Max".

Aliases:
- New `--rename <index> <name>` (also `rename`) sets entry.alias; omit the name
  to clear it. Multi-word names work without quoting.
- getEntryLabel() prefers entry.alias, falling back to the account display name;
  used in list, switch, and remove output.
- syncStoreFromLive now preserves `alias` across syncs (like lastUsedAt/
  usageSnapshot), so it isn't wiped when metadata is refreshed.
- Useful when several accounts share the same Claude display name.

README documents the new flag.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant