config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultDir

func DefaultDir() string

DefaultDir returns the default configuration directory (~/.skael).

func WriteConfig

func WriteConfig(dir string, cfg *Config) error

WriteConfig creates dir if needed and writes cfg to config.json with mode 0600.

func WriteState

func WriteState(dir string, state *SyncState) error

WriteState writes state to state.json in dir with mode 0644.

Types

type Config

type Config struct {
	Endpoint string `json:"endpoint"`
	APIKey   string `json:"api_key"`
	Scope    string `json:"scope,omitempty"`
}

Config holds the CLI configuration stored in config.json.

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig resolves configuration with environment variables taking precedence. It checks SKAEL_URL and SKAEL_KEY first, then falls back to ReadConfig(DefaultDir()). If only one of the two env vars is set, it returns an error naming the missing one.

func ReadConfig

func ReadConfig(dir string) (*Config, error)

ReadConfig reads and parses config.json from dir.

type SyncState

type SyncState struct {
	LastSync string        `json:"last_sync"`
	Skills   []SyncedSkill `json:"skills"`
}

SyncState records the last sync timestamp and each synced skill.

func ReadState

func ReadState(dir string) (*SyncState, error)

ReadState reads state.json from dir. If the file is missing, an empty SyncState is returned without error. If the file is corrupt, it is renamed to state.json.bak and an empty SyncState is returned.

type SyncedSkill

type SyncedSkill struct {
	Name     string `json:"name"`
	Version  int    `json:"version"`
	Checksum string `json:"checksum"`
}

SyncedSkill records a skill name, version, and content checksum.

Jump to

Keyboard shortcuts

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