claudeaccount

package
v1.7.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package claudeaccount stores local Claude Code profile selections. Claude Code itself owns authentication, credentials, and token refresh.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckArgs

func CheckArgs(args []string) error

CheckArgs inspects extra --settings inputs without changing the arguments sent to Claude. Preferences remain native; conflicting auth is refused.

func CheckSettings

func CheckSettings(profile, cwd string) error

CheckSettings refuses conflicting authentication instead of silently replacing an account or a gateway the user configured. Errors name the source and key, never its value.

func Environment

func Environment(inherited []string, profile string) []string

Environment keeps the user's normal environment while selecting an isolated Claude profile. Gateway credentials and platform selectors must not take precedence over that profile's Claude subscription.

func OptionsError

func OptionsError(name string) error

func ProtectedEnvKey

func ProtectedEnvKey(key string) bool

ProtectedEnvKey identifies settings that can replace a subscription's identity or send its bearer token to a different service.

func RoutingEnv

func RoutingEnv(profile string) map[string]string

RoutingEnv is also written at the final settings layer. Removing inherited variables alone is insufficient: project settings can introduce them again.

func ValidateProvider

func ValidateProvider(p provider.Provider) error

Native accounts use their own Claude configuration. Reject CCL proxy/model options instead of accepting settings that this launch deliberately ignores.

Types

type Candidate

type Candidate struct {
	Name string
	Path string
	New  bool
	// contains filtered or unexported fields
}

func (Candidate) ID

func (c Candidate) ID() string

type Store

type Store struct {
	// contains filtered or unexported fields
}

func Open

func Open() (*Store, error)

func (*Store) Activate

func (s *Store) Activate(ctx context.Context, c Candidate) error

Activate records a successful login and selects it for default launches.

func (*Store) ImportLegacy

func (s *Store) ImportLegacy(ctx context.Context, importAccounts func(map[string]string, string) error) error

ImportLegacy transfers the previous local account selector once. The registry and credentials remain untouched; the marker prevents a removed or renamed provider from being recreated on subsequent launches.

func (*Store) List

func (s *Store) List() ([]string, string, error)

func (*Store) PreferName

func (s *Store) PreferName(c Candidate, name string) Candidate

PreferName uses an account's reported email as the generated alias when it is available. Existing aliases are never replaced by a new login.

func (*Store) Prepare

func (s *Store) Prepare(name string) (Candidate, error)

Prepare reserves a private directory for a new login, or returns an existing profile for re-authentication. A new profile is registered only on success.

func (*Store) PrepareExisting

func (s *Store) PrepareExisting(name, id string) (Candidate, error)

PrepareExisting keeps the stable profile id across provider renames and copies, including accounts that need to be signed in again on this device.

func (*Store) PrepareNew

func (s *Store) PrepareNew(name string) (Candidate, error)

PrepareNew creates a distinct profile without consulting legacy aliases.

func (*Store) Profile

func (s *Store) Profile(id string) (string, error)

Profile resolves only an existing locally managed profile, never an arbitrary filesystem path from a synced provider configuration.

func (*Store) Resolve

func (s *Store) Resolve(name string) (string, string, error)

Resolve returns an absolute profile path. An empty name uses the selected account; "default" selects Claude Code's original environment.

func (*Store) Select

func (s *Store) Select(ctx context.Context, name string) error

Select switches the locally managed default account. The reserved name "default" restores the user's original Claude Code configuration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL