Documentation
¶
Overview ¶
Package agentskill bundles the canonical "promptvm" Agent Skill with the CLI and installs it into the local agent skills directories for Claude Code and Codex, so any agent session already knows how to drive PromptVM.
Both agents read the same folder-shaped Agent Skill format (<skills-dir>/<name>/SKILL.md with YAML frontmatter):
- Claude Code: ~/.claude/skills (user) or ./.claude/skills (project)
- Codex: $CODEX_HOME/skills else ~/.agents/skills (user), or ./.agents/skills (project)
Index ¶
Constants ¶
const ( // Name is the skill folder + frontmatter name (valid kebab per // internal/skills.ValidateName). Name = "promptvm" // Version is the bundled skill revision. Bump it whenever the embedded // data/promptvm content changes so `agent status` and first-run can detect // that an update is available. Version = 1 )
const ( // StatusInstalled means the skill was written to disk. StatusInstalled = "installed" // StatusSkipped means the user opted out (reserved; the env opt-out // currently short-circuits before writing a marker). StatusSkipped = "skipped" // StatusNotInstalled is reported by `agent status` when no marker exists. // It is never persisted. StatusNotInstalled = "not-installed" )
Status values for the tracker marker.
Variables ¶
This section is empty.
Functions ¶
func Checksum ¶
func Checksum() string
Checksum returns the sha256 of the bundled SKILL.md, for change detection.
func Files ¶
Files returns the bundled file paths relative to the skill folder root, with forward slashes, sorted.
func TrackerPath ¶
TrackerPath returns the marker path (config.Dir()/agent-skill.json).
func Uninstall ¶
Uninstall removes the given promptvm skill folders. The paths come from the tracker (an on-disk, user-editable file), so it defends against a corrupted or hand-edited marker: it cleans each path, removes only folders whose final element is the skill name, and refuses to follow a symlinked leaf. A missing folder is not an error.
Types ¶
type InstalledTarget ¶
InstalledTarget records where the skill was written.
func Install ¶
func Install(scope Scope, targets []Target, force bool) ([]InstalledTarget, error)
Install writes the bundled skill into each target's skill folder for the given scope and returns the per-target install locations.
When a target's promptvm folder already exists and force is false, Install behaves as follows based on the installed SKILL.md:
- checksum matches the bundle → idempotent no-op
- folder has no readable SKILL.md → treated as not installed; repaired
- checksum differs → error (use force to overwrite)
On error the returned slice contains the targets installed before the failure (Install processes targets sequentially and stops at the first one that errors).
func InstallBestEffort ¶
func InstallBestEffort(scope Scope, targets []Target) []InstalledTarget
InstallBestEffort installs each target independently, skipping (rather than aborting on) any target that errors, and returns the targets that did install. Used by first-run auto-install so a pre-existing/conflicting folder for one agent never blocks installing the other — or permanently wedges the first-run path before a marker can be written.
type Target ¶
Target is one agent's skills location.
func TargetByKey ¶
TargetByKey returns the target with the given key.
type TrackedTarget ¶
TrackedTarget records one installed target location.
type Tracker ¶
type Tracker struct {
Name string `json:"name"`
Version int `json:"version"`
Checksum string `json:"checksum"`
Status string `json:"status"`
Targets []TrackedTarget `json:"targets,omitempty"`
InstalledAt string `json:"installed_at"`
// contains filtered or unexported fields
}
Tracker is the on-disk marker recording what the CLI installed. Its presence is what makes first-run auto-install idempotent.
func LoadTracker ¶
LoadTracker reads the marker. Returns (nil, nil) when absent.