Support custom aliases for OpenAI/Claude account labels
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 19.9k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 30
Description
Feature request
Currently, accounts added via jcode login --provider openai (and similarly for Claude) are stored with auto-numbered labels (openai-1, openai-2, ...) based on positional order in the accounts array. relabel_accounts() in jcode-base/src/auth/account_store.rs runs on every load_auth_file() and force-renumbers any label back to the canonical <prefix>-<index> scheme.
This means:
- You cannot set a persistent custom alias (e.g.
personal,work,codex-alt) for an account — it gets reset toopenai-Non next load. - Reordering/swapping accounts in the underlying JSON file works to change which number an account gets, but there's no way to give it a memorable name.
Suggested behavior
Allow an optional custom alias field on OpenAiAccount / the Claude equivalent that:
- Is preserved across
relabel_accounts()calls (i.e. skip renumbering when a custom alias is present, or keep alias separate from the canonical positional label used internally for override matching). - Is settable via a CLI/TUI flow, e.g.
/account rename openai-2 workorjcode account rename <label> <alias>. - Is displayed in the account picker (
/account,/account openai,/account claude) alongside or instead of the numbered label.
Context
Came up when manually merging two OpenAI accounts into ~/.jcode/openai-auth.json and wanting to label them by which ChatGPT account they represent instead of arbitrary order-dependent numbers.
Relevant code:
crates/jcode-base/src/auth/account_store.rs(relabel_accounts,canonical_account_label)crates/jcode-base/src/auth/codex.rs(OpenAiAccount,JcodeOpenAiAuthFile)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in crates/jcode-base/src/auth/account_store.rs, reading relabel_accounts and canonical_account_label, then inspect OpenAiAccount and JcodeOpenAiAuthFile in crates/jcode-base/src/auth/codex.rs. Trace the account rename entry points and picker flows mentioned in the issue. Done means a custom alias survives loading, can be set through a rename flow, and appears in the OpenAI and Claude account pickers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- authentication, cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100