Documentation
¶
Index ¶
- func AddToLockFile(skill InstalledSkill) error
- func ClearCredentials() error
- func CredentialPath() string
- func InstallPath(skillName string, global bool) string
- func IsInstalled(skillName string) bool
- func IsLoggedIn() bool
- func LockFilePath() string
- func RemoveFromLockFile(skillName string) error
- func SaveCredentials(creds *Credentials) error
- func SaveLockFile(lf *LockFile) error
- type Credentials
- type DeviceAuthResponse
- type InstalledSkill
- type LockFile
- type TokenResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddToLockFile ¶
func AddToLockFile(skill InstalledSkill) error
AddToLockFile adds or updates a skill entry in the lock file.
func ClearCredentials ¶
func ClearCredentials() error
ClearCredentials deletes the credentials file.
func CredentialPath ¶
func CredentialPath() string
CredentialPath returns ~/.config/skillbox/credentials.json.
func InstallPath ¶
InstallPath returns the target directory for a skill. Project-scoped skills are stored under .claude/skills/<name>/SKILL.md relative to the current directory; global skills under ~/.claude/skills/<name>/SKILL.md.
func IsInstalled ¶
IsInstalled checks whether a skill with the given name is present in the lock file.
func IsLoggedIn ¶
func IsLoggedIn() bool
IsLoggedIn returns true if credentials exist and the token has not expired.
func LockFilePath ¶
func LockFilePath() string
LockFilePath returns ~/.config/skillbox/skill-lock.json.
func RemoveFromLockFile ¶
RemoveFromLockFile removes a skill by name from the lock file.
func SaveCredentials ¶
func SaveCredentials(creds *Credentials) error
SaveCredentials writes the credentials to CredentialPath with 0600 permissions. Parent directories are created with 0700.
func SaveLockFile ¶
SaveLockFile writes the lock file with 0600 permissions, creating parent directories (0700) as needed.
Types ¶
type Credentials ¶
type Credentials struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
ExpiresAt time.Time `json:"expires_at"`
Email string `json:"email"`
TenantID string `json:"tenant_id"`
}
Credentials holds the JWT tokens and associated metadata for the current session.
func LoadCredentials ¶
func LoadCredentials() (*Credentials, error)
LoadCredentials reads credentials from CredentialPath. It returns an error if the file is missing or the access token has expired.
type DeviceAuthResponse ¶
type DeviceAuthResponse struct {
DeviceCode string `json:"device_code"`
UserCode string `json:"user_code"`
VerificationURI string `json:"verification_uri"`
VerificationURIComplete string `json:"verification_uri_complete"`
ExpiresIn int `json:"expires_in"`
Interval int `json:"interval"`
}
DeviceAuthResponse represents the response from the device authorization endpoint.
func StartDeviceAuth ¶
func StartDeviceAuth(hydraPublicURL, clientID string) (*DeviceAuthResponse, error)
StartDeviceAuth initiates a device authorization flow with the given Hydra public URL and client ID. It returns the device/user codes and verification URI.
type InstalledSkill ¶
type InstalledSkill struct {
Name string `json:"name"`
Version string `json:"version"`
Provider string `json:"provider"`
Scope string `json:"scope"` // "project" or "global"
Path string `json:"path"`
InstalledAt time.Time `json:"installed_at"`
}
InstalledSkill describes a skill that has been installed locally.
type LockFile ¶
type LockFile struct {
Skills []InstalledSkill `json:"skills"`
}
LockFile holds the set of locally installed skills.
func LoadLockFile ¶
LoadLockFile reads the lock file. If the file does not exist an empty LockFile is returned with no error.
type TokenResponse ¶
type TokenResponse struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
TokenType string `json:"token_type"`
ExpiresIn int `json:"expires_in"`
Scope string `json:"scope"`
}
TokenResponse represents a successful token exchange response.
func PollForToken ¶
func PollForToken(hydraPublicURL, clientID, deviceCode string, interval int) (*TokenResponse, error)
PollForToken polls the token endpoint until the user completes authentication, the code expires, or access is denied. It respects the polling interval and backs off on slow_down responses.