Documentation
¶
Index ¶
- func ClearAssetCache() error
- func EnsureCacheDirs() error
- func GetArtifactCacheDir() (string, error)
- func GetAssetCacheDir() (string, error)
- func GetAssetCachePath(name, version string) (string, error)
- func GetCacheDir() (string, error)
- func GetCachedLockFilePath(repoURL string) (string, error)
- func GetGitRepoCachePath(repoURL string) (string, error)
- func GetGitReposCacheDir() (string, error)
- func GetLockFileCacheDir() (string, error)
- func GetLockFileETagPath(repoURL string) (string, error)
- func GetTrackerCacheDir() (string, error)
- func GetTrackerCachePath(scopeKey string) (string, error)
- func InvalidateLockFileCache(repoURL string) error
- func LoadAssetFromDisk(name, version string) ([]byte, error)
- func LoadETag(repoURL string) (string, error)
- func LoadLockFile(repoURL string) ([]byte, error)
- func SaveAssetToDisk(name, version string, data []byte) error
- func SaveETag(repoURL, etag string) error
- func SaveLockFile(repoURL string, data []byte) error
- type ETagCache
- type LockFileHistoryEntry
- type SessionCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearAssetCache ¶
func ClearAssetCache() error
ClearAssetCache removes cached assets for cleanup
func EnsureCacheDirs ¶
func EnsureCacheDirs() error
EnsureCacheDirs creates all necessary cache directories
func GetArtifactCacheDir ¶
GetArtifactCacheDir is an alias for GetAssetCacheDir for backwards compatibility Deprecated: use GetAssetCacheDir instead
func GetAssetCacheDir ¶
GetAssetCacheDir returns the directory for caching assets
func GetAssetCachePath ¶
GetAssetCachePath returns the cache path for a specific asset
func GetCacheDir ¶
GetCacheDir returns the platform-specific cache directory for sx
func GetCachedLockFilePath ¶
GetCachedLockFilePath returns path for cached lock file
func GetGitRepoCachePath ¶
GetGitRepoCachePath returns the cache path for a git repository
func GetGitReposCacheDir ¶
GetGitReposCacheDir returns the directory for caching git repositories
func GetLockFileCacheDir ¶
GetLockFileCacheDir returns the directory for caching lock files
func GetLockFileETagPath ¶
GetLockFileETagPath returns the path for storing lock file ETag
func GetTrackerCacheDir ¶
GetTrackerCacheDir returns the directory for tracking installed assets state
func GetTrackerCachePath ¶
GetTrackerCachePath returns the path for tracking installed assets scopeKey should be "global" or a hash/identifier for repo-scoped installs
func InvalidateLockFileCache ¶ added in v0.6.0
InvalidateLockFileCache removes cached lock file and ETag for a repository URL This forces the next GetLockFile call to fetch fresh data from the backend
func LoadAssetFromDisk ¶
LoadAssetFromDisk loads a cached asset from disk
func LoadLockFile ¶
LoadLockFile loads cached lock file
func SaveAssetToDisk ¶
SaveAssetToDisk caches an asset zip to disk
func SaveLockFile ¶
SaveLockFile caches a resolved lock file to disk. If a previous lock exists for the same vault and its content differs from the new data, the previous file is renamed with a timestamp suffix so older versions stay around for diffing and rollback. Matching content is a no-op that still refreshes the mtime.
Types ¶
type ETagCache ¶
type ETagCache struct {
URL string `json:"url"`
ETag string `json:"etag"`
Date time.Time `json:"date"`
}
ETagCache stores ETags for lock files
type LockFileHistoryEntry ¶ added in v0.15.0
LockFileHistoryEntry describes one rotated lock file.
func ListLockFileHistory ¶ added in v0.15.0
func ListLockFileHistory(repoURL string) ([]LockFileHistoryEntry, error)
ListLockFileHistory returns every rotated lock file for a vault, sorted newest first. The active (non-rotated) `<vaultID>.lock` is not included.
type SessionCache ¶
type SessionCache struct {
// contains filtered or unexported fields
}
SessionCache provides fast conversation/session ID tracking for clients that fire hooks on every prompt rather than once per session.
File format: Line-based, space-separated `session_id timestamp` Example:
668320d2-2fd8-4888-b33c-2a466fec86e7 2025-12-12T10:30:00Z 490b90b7-a2ce-4c2c-bb76-cb77b125df2f 2025-12-11T15:45:00Z
func NewSessionCache ¶
func NewSessionCache(clientID string) (*SessionCache, error)
NewSessionCache creates a session cache for the given client ID
func (*SessionCache) Clear ¶
func (s *SessionCache) Clear() error
Clear removes all session entries.
func (*SessionCache) CullOldEntries ¶
func (s *SessionCache) CullOldEntries(maxAge time.Duration) error
CullOldEntries removes entries older than the specified max age. This keeps the session file from growing indefinitely.
func (*SessionCache) FilePath ¶
func (s *SessionCache) FilePath() string
FilePath returns the path to the session cache file (for testing/debugging).
func (*SessionCache) HasSession ¶
func (s *SessionCache) HasSession(sessionID string) bool
HasSession checks if a session ID has been seen before. This is optimized for fast checks (~1ms) by scanning the file line by line.
func (*SessionCache) RecordSession ¶
func (s *SessionCache) RecordSession(sessionID string) error
RecordSession records a session ID with the current timestamp. Should be called optimistically before installation starts.