Documentation
¶
Index ¶
Constants ¶
const ( DefaultAPIURL = "https://api.cubepath.com" DefaultProfileName = "default" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
CurrentProfile string `json:"current_profile"`
Profiles map[string]*Profile `json:"profiles"`
// OAuthClients maps an authorization server issuer to the client_id this
// machine registered there, reused by every login.
OAuthClients map[string]string `json:"oauth_clients,omitempty"`
// SkillsPrompted records that `cubecli login` already offered to install
// the agent skills, so it asks only once.
SkillsPrompted bool `json:"skills_prompted,omitempty"`
// MCPPrompted records the same for the MCP server.
MCPPrompted bool `json:"mcp_prompted,omitempty"`
}
func Load ¶
Load reads and parses the config file, migrating the legacy format on the fly. Returns an error if the file is missing or empty; callers that want to fall back to env vars should use ActiveProfile instead.
func LoadOrEmpty ¶ added in v1.2.0
func LoadOrEmpty() *Config
LoadOrEmpty returns the parsed config or an empty one if no file exists yet.
func (*Config) ActiveProfile ¶ added in v1.2.0
ActiveProfile returns the profile that should serve the current invocation. If CUBE_API_TOKEN is set, it synthesizes an ephemeral profile so env-based auth keeps working even without a config file.
func (*Config) ActiveProfileName ¶ added in v1.2.0
ActiveProfileName resolves which profile should be used, in order: explicit name > CUBE_PROFILE env > cfg.CurrentProfile > "default".
func (*Config) ProfileNames ¶ added in v1.2.0
type OAuthCredentials ¶ added in v1.6.0
type OAuthCredentials struct {
Issuer string `json:"issuer"`
TokenEndpoint string `json:"token_endpoint"`
RevokeEndpoint string `json:"revocation_endpoint,omitempty"`
ClientID string `json:"client_id"`
Resource string `json:"resource"`
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
AccessExpiresAt time.Time `json:"access_expires_at"`
Scopes []string `json:"scopes,omitempty"`
Email string `json:"email,omitempty"`
Organization string `json:"organization,omitempty"`
}
OAuthCredentials is the session stored by `cubecli login`.
type Profile ¶ added in v1.2.0
type Profile struct {
APIToken string `json:"api_token,omitempty"`
APIURL string `json:"api_url,omitempty"`
OAuth *OAuthCredentials `json:"oauth,omitempty"`
}
Profile holds the credentials for one account/organization. Exactly one of APIToken (static token, e.g. for CI) or OAuth (browser login) is set.
func (*Profile) AuthMethod ¶ added in v1.6.0
AuthMethod reports how a profile authenticates: "oauth", "token" or "".