Documentation
¶
Index ¶
- Constants
- func Authenticate(ctx context.Context, serverURL string) (string, error)
- func Exists() bool
- func IsSilent() bool
- func OpenBrowser(verificationURI string) error
- func Save(cfg *Config) error
- type Config
- type OAuthClient
- type OAuthDeviceCodeResponse
- type OAuthTokenResponse
- 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" )
Variables ¶
This section is empty.
Functions ¶
func Authenticate ¶
Authenticate performs the full OAuth device code flow
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"`
}
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) 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
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" )