Documentation
¶
Overview ¶
Package codexaccounts keeps more than one sign-in of the Codex CLI on a machine. Codex keeps its sign-in in $CODEX_HOME/auth.json and renews it there itself, so a second sign-in is a second home, and the home is the sign-in's own whole: its auth.json, its sessions, its databases and everything else the CLI writes. Nothing in it is a link to the main home, and the main home (the CLI's own, ~/.codex) is only ever read. What a person sets up by hand there (settings) is copied into the sign-in's home before a launch on it (Sync), so the main home stays the one place to change it.
Index ¶
- Constants
- Variables
- type Account
- type Store
- func (s *Store) Add(name string) (Account, error)
- func (s *Store) AuthFile(id string) string
- func (s *Store) Home(id string) string
- func (s *Store) List() ([]Account, error)
- func (s *Store) Remove(id string) error
- func (s *Store) Rename(id, name string) (Account, error)
- func (s *Store) SetMain(id string) error
- func (s *Store) SignedIn(id string) bool
- func (s *Store) Sync(id string) error
Constants ¶
const ( MaxAccounts = 8 MaxName = 60 )
MaxAccounts caps the sign-ins of a machine; MaxName a name's length in runes.
Variables ¶
var ( ErrNotFound = errors.New("codexaccounts: no such account") ErrTooMany = errors.New("codexaccounts: too many accounts") ErrBadName = errors.New("codexaccounts: the name is empty, too long or taken") )
The refusals the caller is told.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
ID string `json:"id"`
Name string `json:"name"`
// Main: a new Codex chat that names no sign-in is offered this one first. One account at most; none means the
// CLI's own home.
Main bool `json:"main,omitempty"`
}
Account is one more sign-in of Codex beside the main one (the main one is the CLI's own home and is not listed).
type Store ¶
type Store struct {
// Dir is the runtime's data folder: the list is <Dir>/v2/codex-accounts.json, a home <Dir>/codex-accounts/<id>.
Dir string
Main string
// contains filtered or unexported fields
}
Store keeps the accounts of a data folder. Main is the CLI's own home (~/.codex or $CODEX_HOME).
func (*Store) Home ¶
Home is the CODEX_HOME of an account. It is named .codex like the main one, so a transcript in it reads as Codex's wherever a path is told apart by that name.
func (*Store) Remove ¶
Remove forgets an account and takes its home away: its sign-in, its sessions and its copies of the settings. The main home has nothing of it.
func (*Store) SetMain ¶
SetMain makes an account the one a new chat is offered first; "" gives that back to the CLI's own home.