Documentation
¶
Overview ¶
Package claudeskill installs, checks and removes the hopsesh skill for Claude Code: a personal skill at <claude config dir>/skills/hopsesh that teaches Claude to list and move sessions with the hopsesh CLI (plan first, move only after the user says yes).
The files are rendered from templates in this binary. An install record (.hopsesh-install.json, beside SKILL.md) keeps the hash of every file hopsesh wrote, so a skill is "current" (matches this build), "stale" (written by an older hopsesh and not edited since: safe to replace), "modified" (the user edited it: never overwritten without force), "foreign" (a skill called hopsesh that hopsesh did not write), "broken" or absent.
Index ¶
- Constants
- Variables
- func AddRules(settingsPath, bin string) ([]string, error)
- func Dir(configDir string) string
- func HasRules(settingsPath, bin string) bool
- func Remove(configDir string, p Params, force bool) error
- func Render(p Params) (map[string][]byte, error)
- func Rules(bin string) (allow, ask []string)
- type Params
- type Record
- type Status
Constants ¶
const ( Absent = "absent" Current = "current" Stale = "stale" Modified = "modified" Foreign = "foreign" Broken = "broken" )
States of an installed skill.
const Format = "1"
Format changes when the skill's structure changes in a way older hopsesh versions would not understand.
const Name = "hopsesh"
Name is the skill's name and folder.
Variables ¶
var ErrForeign = errors.New("a skill called hopsesh already exists and was not installed by hopsesh")
ErrForeign means a skill called hopsesh exists that hopsesh did not install.
var ErrModified = errors.New("the hopsesh skill was edited after hopsesh installed it")
ErrModified means the skill was edited by the user; Install needs force to replace it.
Functions ¶
func AddRules ¶
AddRules merges Rules into a Claude Code settings.json (creating it if needed), keeping everything else and a backup of the previous file. It returns the rules it added.
func Remove ¶
Remove deletes the skill when hopsesh owns it unchanged (current, stale or broken), or with force.
Types ¶
type Params ¶
type Params struct {
Bin string // how Claude should run hopsesh: "hopsesh" or an absolute path
Version string
Format string
}
Params fill the templates.
type Record ¶
type Record struct {
Format string `json:"format"`
Version string `json:"hopseshVersion"`
Bin string `json:"bin"`
Files map[string]string `json:"files"` // name → sha256
}
Record is the install record.
type Status ¶
type Status struct {
State string `json:"state"`
Dir string `json:"dir"`
Version string `json:"installedVersion,omitempty"`
Bin string `json:"bin,omitempty"`
Changed []string `json:"changedFiles,omitempty"` // files the user edited (modified)
NewSkills bool `json:"newSkillsFolder,omitempty"`
}
Status describes the skill on disk.