state

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseDir added in v0.0.12

func BaseDir(homeDir string) string

BaseDir returns the path to the cortex-ia home directory (~/.cortex-ia/).

func ClearInstallStatus added in v0.0.18

func ClearInstallStatus(homeDir string) error

ClearInstallStatus removes the install status file, indicating a clean state.

func CommunitySkillsDir added in v0.0.18

func CommunitySkillsDir(homeDir string) string

CommunitySkillsDir returns the path to community skills.

func EnsureDir added in v0.0.12

func EnsureDir(homeDir string) error

EnsureDir creates the cortex-ia base directory and its core subdirectories (skills, prompts) if they do not already exist.

func InstallStatusPath added in v0.0.18

func InstallStatusPath(homeDir string) string

InstallStatusPath returns the path to the install status file.

func ListCommunitySkills added in v0.0.18

func ListCommunitySkills(homeDir string) []string

ListCommunitySkills returns the names of installed community skills. A directory is considered a skill if it contains a SKILL.md file.

func LoadOpenCodeModels added in v0.3.0

func LoadOpenCodeModels(homeDir string) (model.OpenCodeModelAssignments, error)

LoadOpenCodeModels reads OpenCode model assignments from ~/.cortex-ia/opencode-models.json.

func LoadProfiles added in v0.0.18

func LoadProfiles(homeDir string) ([]model.Profile, error)

LoadProfiles reads saved profiles from disk. Returns nil, nil when the file does not exist yet.

func LockPath added in v0.0.5

func LockPath(homeDir string) string

LockPath returns the path to the lock file.

func ProfilesPath added in v0.0.18

func ProfilesPath(homeDir string) string

ProfilesPath returns the path to the profiles file.

func Save

func Save(homeDir string, s State) error

Save writes the state file.

func SaveInstallStatus added in v0.0.18

func SaveInstallStatus(homeDir string, status InstallStatus) error

SaveInstallStatus writes the install status file.

func SaveLock added in v0.0.5

func SaveLock(homeDir string, lock Lockfile) error

SaveLock writes the lock file.

func SaveOpenCodeModels added in v0.3.0

func SaveOpenCodeModels(homeDir string, assignments model.OpenCodeModelAssignments) error

SaveOpenCodeModels writes OpenCode model assignments to ~/.cortex-ia/opencode-models.json.

func SaveProfiles added in v0.0.18

func SaveProfiles(homeDir string, profiles []model.Profile) error

SaveProfiles writes profiles to disk, creating the directory if needed.

func SharedPromptsDir added in v0.0.5

func SharedPromptsDir(homeDir string) string

SharedPromptsDir returns the shared prompts directory (~/.cortex-ia/prompts/).

func SharedSkillsDir added in v0.0.5

func SharedSkillsDir(homeDir string) string

SharedSkillsDir returns the shared skills directory for all agents (~/.cortex-ia/skills/).

func StatePath

func StatePath(homeDir string) string

StatePath returns the path to the state file.

Types

type InstallStatus added in v0.0.18

type InstallStatus struct {
	Status    string `json:"status"`              // "in-progress" or "complete"
	StartedAt string `json:"started_at"`          // RFC3339 timestamp
	BackupID  string `json:"backup_id,omitempty"` // backup created before this install
}

InstallStatus tracks whether an installation completed cleanly. If the process crashes or a component fails mid-way, the status remains "in-progress" so that doctor/repair can detect it.

func LoadInstallStatus added in v0.0.18

func LoadInstallStatus(homeDir string) (*InstallStatus, error)

LoadInstallStatus reads the install status file. Returns nil if the file does not exist (meaning no install is in progress and none was left dirty).

type Lockfile added in v0.0.5

type Lockfile struct {
	InstalledAgents []model.AgentID     `json:"installed_agents"`
	Preset          model.PresetID      `json:"preset,omitempty"`
	Components      []model.ComponentID `json:"components,omitempty"`
	Files           []string            `json:"files,omitempty"`
	GeneratedAt     time.Time           `json:"generated_at"`
	LastBackupID    string              `json:"last_backup_id,omitempty"`
	Version         string              `json:"version,omitempty"`
}

Lockfile captures the concrete installed artifact set for verification and repair.

func LoadLock added in v0.0.5

func LoadLock(homeDir string) (Lockfile, error)

LoadLock reads the lock file. Returns empty lock if not found.

type State

type State struct {
	InstalledAgents []model.AgentID     `json:"installed_agents"`
	Preset          model.PresetID      `json:"preset,omitempty"`
	Components      []model.ComponentID `json:"components,omitempty"`
	LastInstall     time.Time           `json:"last_install"`
	LastBackupID    string              `json:"last_backup_id,omitempty"`
	Version         string              `json:"version,omitempty"`
	LastProfile     string              `json:"last_profile,omitempty"`
	StrictTDD       bool                `json:"strict_tdd,omitempty"`
}

State tracks what cortex-ia has installed.

func Load

func Load(homeDir string) (State, error)

Load reads the state file. Returns empty state if not found.

Jump to

Keyboard shortcuts

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