cli

package
v0.12.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

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

func InstallPath(skillName string, global bool) string

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

func IsInstalled(skillName string) bool

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

func RemoveFromLockFile(skillName string) error

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

func SaveLockFile(lf *LockFile) error

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

func LoadLockFile() (*LockFile, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL