Documentation
¶
Index ¶
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" )
Variables ¶
This section is empty.
Functions ¶
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
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"`
// EnabledClients is the list of client IDs that assets should be installed to.
// An empty/nil slice means "all detected clients" (backwards compatible default).
EnabledClients []string `json:"enabledClients,omitempty"`
}
Config represents the configuration for the skills CLI
func Load ¶
Load loads the configuration from the config file Falls back to the old location (~/.claude/plugins/skills/config.json) for backwards compatibility
func (*Config) GetAuthToken ¶
GetAuthToken returns the auth token
func (*Config) GetEnabledClients ¶ added in v0.5.4
GetEnabledClients returns the list of enabled client IDs. Returns nil if not explicitly configured (meaning use all detected).
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) IsClientEnabled ¶ added in v0.5.4
IsClientEnabled checks if a specific client ID is enabled. If EnabledClients is empty/nil, all clients are considered enabled (backwards compatible).
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 RepositoryType ¶
type RepositoryType string
RepositoryType represents the type of repository (sleuth, git, or path)
const ( RepositoryTypeSleuth RepositoryType = "sleuth" RepositoryTypeGit RepositoryType = "git" RepositoryTypePath RepositoryType = "path" )