Documentation
¶
Index ¶
- Constants
- func Exists() bool
- func GetActiveProfileName(mpc *MultiProfileConfig) string
- func GetActiveProfileOverride() string
- func IsSilent() bool
- func OpenBrowser(verificationURI string) error
- func Save(cfg *Config) error
- func SaveMultiProfile(mpc *MultiProfileConfig) error
- func SaveToProfile(cfg *Config, profileName string) error
- func SetActiveProfile(name string)
- type Config
- func (c *Config) GetAuthToken() string
- func (c *Config) GetRepositoryURL() string
- func (c *Config) GetServerURL() string
- func (c *Config) GetType() string
- func (c *Config) HasExplicitClientConfig() bool
- func (c *Config) IsClientEnabled(clientID string) bool
- func (c *Config) IsClientForceDisabled(clientID string) bool
- func (c *Config) IsClientForceEnabled(clientID string) bool
- func (c *Config) Validate() error
- type MultiProfileConfig
- func (mpc *MultiProfileConfig) DeleteProfile(name string) error
- func (mpc *MultiProfileConfig) GetBootstrapOption(key string) bool
- func (mpc *MultiProfileConfig) GetProfile(name string) (*Profile, bool)
- func (mpc *MultiProfileConfig) ListProfiles() []string
- func (mpc *MultiProfileConfig) MigrateEnabledClients(allClientIDs []string) (bool, error)
- func (mpc *MultiProfileConfig) NeedsMigration() bool
- func (mpc *MultiProfileConfig) SetBootstrapOption(key string, enabled bool)
- func (mpc *MultiProfileConfig) SetDefaultProfile(name string) error
- func (mpc *MultiProfileConfig) SetProfile(name string, profile *Profile)
- type OAuthClient
- type OAuthDeviceCodeResponse
- type OAuthTokenResponse
- type Profile
- type RepositoryType
Constants ¶
const ( // DefaultPollInterval is the default interval for polling the token endpoint DefaultPollInterval = 5 * time.Second // OAuthClientID is the well-known client ID for the Skills CLI OAuthClientID = "sleuth-skills-claude-code" )
const DefaultProfileName = "default"
DefaultProfileName is the name used for the default profile
Variables ¶
This section is empty.
Functions ¶
func GetActiveProfileName ¶ added in v0.7.0
func GetActiveProfileName(mpc *MultiProfileConfig) string
GetActiveProfileName returns the name of the profile that should be used
func GetActiveProfileOverride ¶ added in v0.7.0
func GetActiveProfileOverride() string
GetActiveProfileOverride returns the current profile override, if any
func IsSilent ¶
func IsSilent() bool
IsSilent checks if silent mode is enabled via environment variable
func OpenBrowser ¶
OpenBrowser opens the verification URI in the user's default browser
func Save ¶
Save saves the configuration to the config file This updates the active profile while preserving other profiles
func SaveMultiProfile ¶ added in v0.7.0
func SaveMultiProfile(mpc *MultiProfileConfig) error
SaveMultiProfile saves the full multi-profile configuration
func SaveToProfile ¶ added in v0.7.0
SaveToProfile saves the configuration to a specific profile If profileName is empty, uses the active profile
func SetActiveProfile ¶ added in v0.7.0
func SetActiveProfile(name string)
SetActiveProfile sets the active profile for the current session This is typically set from a --profile flag or SX_PROFILE env var
Types ¶
type Config ¶
type Config struct {
// Type of repository: "sleuth", "git", or "path"
Type RepositoryType `json:"type"`
// ServerURL is the Sleuth server URL (only for type=sleuth)
ServerURL string `json:"serverUrl,omitempty"`
// AuthToken is the OAuth token for Sleuth server (only for type=sleuth)
AuthToken string `json:"authToken,omitempty"`
// RepositoryURL is the repository URL
// - For git: git repository URL (https://github.com/org/repo.git)
// - For path: file:// URL pointing to local directory (file:///path/to/repo)
RepositoryURL string `json:"repositoryUrl,omitempty"`
// ForceEnabledClients is the list of client IDs that should always be enabled,
// even if not detected.
ForceEnabledClients []string `json:"forceEnabledClients,omitempty"`
// ForceDisabledClients is the list of client IDs that should always be disabled,
// even if detected.
ForceDisabledClients []string `json:"forceDisabledClients,omitempty"`
}
Config represents the configuration for the skills CLI
func Load ¶
Load loads the configuration from the config file Uses the multi-profile system and returns the active profile as a Config
func (*Config) GetAuthToken ¶
GetAuthToken returns the auth token
func (*Config) GetRepositoryURL ¶
GetRepositoryURL returns the repository URL
func (*Config) GetServerURL ¶
GetServerURL returns the Sleuth server URL, with environment override For backwards compatibility, falls back to ServerURL if RepositoryURL is empty
func (*Config) HasExplicitClientConfig ¶ added in v0.11.0
HasExplicitClientConfig returns true if any force enable/disable settings exist.
func (*Config) IsClientEnabled ¶ added in v0.5.4
IsClientEnabled checks if a specific client ID is enabled. ForceDisabled takes precedence over ForceEnabled. If neither, the client is enabled by default (relies on detection).
func (*Config) IsClientForceDisabled ¶ added in v0.11.0
IsClientForceDisabled checks if a client is explicitly force-disabled.
func (*Config) IsClientForceEnabled ¶ added in v0.11.0
IsClientForceEnabled checks if a client is explicitly force-enabled.
type MultiProfileConfig ¶ added in v0.7.0
type MultiProfileConfig struct {
// DefaultProfile is the name of the currently active profile
DefaultProfile string `json:"defaultProfile"`
// Profiles is a map of profile name to profile configuration
Profiles map[string]*Profile `json:"profiles"`
// EnabledClients is DEPRECATED - use ForceEnabledClients/ForceDisabledClients instead.
// Kept for migration purposes only.
EnabledClients []string `json:"enabledClients,omitempty"`
// ForceEnabledClients is the list of client IDs that should always be enabled,
// even if not detected. This is global across all profiles.
ForceEnabledClients []string `json:"forceEnabledClients,omitempty"`
// ForceDisabledClients is the list of client IDs that should always be disabled,
// even if detected. This is global across all profiles.
ForceDisabledClients []string `json:"forceDisabledClients,omitempty"`
// BootstrapOptions stores user consent for bootstrap items (hooks, MCP servers).
// Keyed by option key, nil/missing = yes (backwards compatible).
BootstrapOptions map[string]*bool `json:"bootstrapOptions,omitempty"`
}
MultiProfileConfig represents the full configuration file with multiple profiles
func LoadMultiProfile ¶ added in v0.7.0
func LoadMultiProfile() (*MultiProfileConfig, error)
LoadMultiProfile loads the full multi-profile configuration
func (*MultiProfileConfig) DeleteProfile ¶ added in v0.7.0
func (mpc *MultiProfileConfig) DeleteProfile(name string) error
DeleteProfile removes a profile by name
func (*MultiProfileConfig) GetBootstrapOption ¶ added in v0.9.2
func (mpc *MultiProfileConfig) GetBootstrapOption(key string) bool
GetBootstrapOption returns whether a bootstrap option is enabled. Returns true if the option is missing/nil (backwards compatible - existing users get everything).
func (*MultiProfileConfig) GetProfile ¶ added in v0.7.0
func (mpc *MultiProfileConfig) GetProfile(name string) (*Profile, bool)
GetProfile returns a profile by name
func (*MultiProfileConfig) ListProfiles ¶ added in v0.7.0
func (mpc *MultiProfileConfig) ListProfiles() []string
ListProfiles returns a sorted list of profile names
func (*MultiProfileConfig) MigrateEnabledClients ¶ added in v0.11.0
func (mpc *MultiProfileConfig) MigrateEnabledClients(allClientIDs []string) (bool, error)
MigrateEnabledClients migrates the deprecated EnabledClients field to the new ForceEnabledClients/ForceDisabledClients fields. Call this with all known client IDs. Returns true if migration was performed and config was saved.
func (*MultiProfileConfig) NeedsMigration ¶ added in v0.11.0
func (mpc *MultiProfileConfig) NeedsMigration() bool
NeedsMigration returns true if the config has deprecated EnabledClients field
func (*MultiProfileConfig) SetBootstrapOption ¶ added in v0.9.2
func (mpc *MultiProfileConfig) SetBootstrapOption(key string, enabled bool)
SetBootstrapOption sets a bootstrap option value.
func (*MultiProfileConfig) SetDefaultProfile ¶ added in v0.7.0
func (mpc *MultiProfileConfig) SetDefaultProfile(name string) error
SetDefaultProfile sets the default profile
func (*MultiProfileConfig) SetProfile ¶ added in v0.7.0
func (mpc *MultiProfileConfig) SetProfile(name string, profile *Profile)
SetProfile adds or updates a profile
type OAuthClient ¶
type OAuthClient struct {
// contains filtered or unexported fields
}
OAuthClient handles OAuth device code flow
func NewOAuthClient ¶
func NewOAuthClient(serverURL string) *OAuthClient
NewOAuthClient creates a new OAuth client
func (*OAuthClient) PollForToken ¶
func (o *OAuthClient) PollForToken(ctx context.Context, deviceCode string) (*OAuthTokenResponse, error)
PollForToken polls the token endpoint until the user completes authorization
func (*OAuthClient) StartDeviceFlow ¶
func (o *OAuthClient) StartDeviceFlow(ctx context.Context) (*OAuthDeviceCodeResponse, error)
StartDeviceFlow initiates the OAuth device code flow
type OAuthDeviceCodeResponse ¶
type OAuthDeviceCodeResponse struct {
DeviceCode string `json:"device_code"`
UserCode string `json:"user_code"`
VerificationURI string `json:"verification_uri"`
VerificationURIComplete string `json:"verification_uri_complete,omitempty"`
ExpiresIn int `json:"expires_in"`
Interval int `json:"interval,omitempty"`
}
OAuthDeviceCodeResponse represents the response from the device authorization endpoint
type OAuthTokenResponse ¶
type OAuthTokenResponse struct {
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
ExpiresIn int `json:"expires_in,omitempty"`
RefreshToken string `json:"refresh_token,omitempty"`
Error string `json:"error,omitempty"`
ErrorDesc string `json:"error_description,omitempty"`
}
OAuthTokenResponse represents the response from the token endpoint
type Profile ¶ added in v0.7.0
type Profile struct {
// Type of repository: "sleuth", "git", or "path"
Type RepositoryType `json:"type"`
// ServerURL is the Sleuth server URL (only for type=sleuth)
ServerURL string `json:"serverUrl,omitempty"`
// AuthToken is the OAuth token for Sleuth server (only for type=sleuth)
AuthToken string `json:"authToken,omitempty"`
// RepositoryURL is the repository URL
// - For git: git repository URL (https://github.com/org/repo.git)
// - For path: file:// URL pointing to local directory (file:///path/to/repo)
RepositoryURL string `json:"repositoryUrl,omitempty"`
}
Profile represents a single configuration profile
func ProfileFromConfig ¶ added in v0.7.0
ProfileFromConfig creates a Profile from a Config
type RepositoryType ¶
type RepositoryType string
RepositoryType represents the type of repository (sleuth, git, or path)
const ( RepositoryTypeSleuth RepositoryType = "sleuth" RepositoryTypeGit RepositoryType = "git" RepositoryTypePath RepositoryType = "path" )