Documentation
¶
Overview ¶
Package active manages the project active-skill layer: the per-skill entry at .agents/skills/<name> that links into the content store and is the single source of truth every agent target derives from.
The three layers gskill maintains are:
.gskill/store/<algo>/<hash> immutable canonical content (one physical copy)
▲ symlink (copy fallback)
.agents/skills/<name> active project skill (one per installed skill)
▲ symlink (copy fallback)
.<agent>/skills/<name> per-agent targets (claude, codex, cursor, …)
The active layer holds no independent copy of the content: it links into the store, so adding an agent is one cheap link and a skill shared by N agents still exists exactly once on disk. The active layer is gitignored and regenerated by `gskill sync` from the committed manifest + lockfile.
Index ¶
- func Dir(root string) string
- func EnsureActive(root, name, storePath string, storeRoots ...string) (string, error)
- func List(root string) ([]string, error)
- func Owned(dest string, roots []string, acceptHashes ...string) bool
- func Path(root, name string) string
- func Rel(name string) string
- func Remove(root, name string) error
- type Health
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureActive ¶
EnsureActive makes the active entry for name resolve to storePath, preferring a symlink and falling back to a copy where symlinks are unsupported. It is idempotent (an entry already linking to storePath is left untouched) and re-points a stale gskill-managed symlink (one resolving into storeRoot) after a content update. It NEVER destroys foreign content: a symlink resolving outside storeRoot, or a real directory whose content does not match the store, fails closed and is left intact (FR-029/FR-030).
func Owned ¶ added in v0.3.0
Owned reports whether dest is gskill-managed content: a symlink resolving under any of the given roots, or a real directory whose content hash matches one of acceptHashes (a copy-mode install). A missing dest is not owned. This is the single ownership predicate shared by the installer's overwrite guard and the plan layer's conflict detection, so the two cannot drift (spec 011 FR-016).
Types ¶
type Health ¶
type Health string
Health classifies the state of an active entry relative to its expected store target.
const ( // HealthOK means the entry is a symlink resolving to the expected store path. HealthOK Health = "ok" // HealthMissing means no entry exists. HealthMissing Health = "missing" // HealthBroken means the entry is a symlink whose target does not exist. HealthBroken Health = "broken" // HealthForeign means a non-symlink path occupies the entry (not gskill-managed). HealthForeign Health = "foreign" // HealthWrongStore means the entry is a symlink into the store but at the // wrong content path (e.g. stale after a content update). HealthWrongStore Health = "wrong-store-target" )
Active-entry health states.