Documentation
¶
Overview ¶
Package projstate manages a project's gitignored machine-local state file (.gskill/state.json): the stable project identifier, the global store object each skill activates, and the links gskill owns. The state exists for safe repair and removal only — a project is always restorable from its committed skills-lock.json alone, and deleting the state file simply regenerates it with a fresh project ID.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AgentState ¶
AgentState is one gskill-created agent target.
type SkillState ¶
type SkillState struct {
Agents map[string]AgentState `json:"agents,omitempty"`
// Legacy v1 fields: read for migration detection (spec 022 §9), never
// written — a v1 file upgrades on its next Save.
StoreHash string `json:"storeHash,omitempty"`
StoreScope string `json:"storeScope,omitempty"`
ActiveTarget string `json:"activeTarget,omitempty"`
ActiveMode string `json:"activeMode,omitempty"`
}
SkillState records the gskill-created agent targets for one skill — the only machine-local facts left in the repo-owned model (spec 022 data-model §4): per-agent mode records the symlink→copy fallback, which is per-agent and per-machine. The active entry is always `.agents/skills/<name>` (derivable) and content identity lives in the committed lockfile.
type State ¶
type State struct {
SchemaVersion int `json:"schemaVersion"`
ProjectID string `json:"projectId"`
Skills map[string]SkillState `json:"skills"`
// contains filtered or unexported fields
}
State is a project's machine-local installation record. It is gitignored, never required to reproduce the project (the lockfile alone restores it, FR-015), and safe to delete: a fresh state with a new project ID is generated on the next gskill operation.
func LoadOrInit ¶
LoadOrInit loads the project state under root, or initializes a fresh one (with a newly generated stable project ID) when none exists. A fresh state is not persisted until Save is called.
func (*State) RemoveSkill ¶
RemoveSkill drops the record for name.
func (*State) Save ¶
Save writes the state atomically and deterministically (map keys are sorted by encoding/json).
func (*State) SetSkill ¶
func (s *State) SetSkill(name string, sk SkillState)
SetSkill records the state for name.