skills

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package skills contains the embedded skill definitions for tfctl.

Index

Constants

View Source
const (
	// TFCTLSkillPath is the path to the embedded SKILL.md file within the binary.
	TFCTLSkillPath = "tfctl/SKILL.md"
	// TFCTLKnownHashesPath is the path to the embedded hashes file within the binary.
	TFCTLKnownHashesPath = "tfctl/known_release_hashes"
)

Variables

View Source
var (

	// AgentNames is a list of the names of all supported agents.
	AgentNames []string
)

FS is the embedded filesystem containing the skill definitions for tfctl.

Functions

func EmbeddedSkillHash added in v0.4.0

func EmbeddedSkillHash() string

EmbeddedSkillHash returns the SHA256 hash of the embedded SKILL.md file.

Types

type AgentSpec

type AgentSpec struct {
	Name                string
	DisplayName         string
	SkillsDir           string
	GlobalSkillsDir     func() string
	DetectInstalled     func() bool
	DetectParentProcess func() bool
}

AgentSpec defines the necessary information to install a skill for a coding agent.

func DetectAgent

func DetectAgent() (AgentSpec, bool)

DetectAgent returns the first AgentSpec for any agent detected on the current system.

func DetectAgents added in v0.4.0

func DetectAgents() []AgentSpec

DetectAgents returns a list of AgentSpecs for agents detected on the current system.

func GetAgent

func GetAgent(name string) (AgentSpec, bool)

GetAgent returns the AgentSpec for a given agent name, along with a boolean indicating whether the agent was found.

func (*AgentSpec) DetectGloballyInstalledSkill added in v0.4.0

func (a *AgentSpec) DetectGloballyInstalledSkill() *InstalledSkill

DetectGloballyInstalledSkill checks if the tfctl skill already exists for the agent in the global config directory, and returns an InstalledSkill if found.

func (*AgentSpec) DetectLocallyInstalledSkill added in v0.4.0

func (a *AgentSpec) DetectLocallyInstalledSkill() *InstalledSkill

DetectLocallyInstalledSkill checks if the tfctl skill already exists for the agent in the local project directory, and returns an InstalledSkill if found.

func (AgentSpec) InstallSkill

func (a AgentSpec) InstallSkill(global bool) error

InstallSkill installs the tfctl skill for the agent, either to the project directory or the global config directory based on the value of the global parameter.

func (*AgentSpec) InstalledSkills added in v0.4.0

func (a *AgentSpec) InstalledSkills() iter.Seq[*InstalledSkill]

InstalledSkills returns a sequence of both/either/neither installed skills for the agent. First local, then global.

type InstalledSkill added in v0.4.0

type InstalledSkill struct {
	// contains filtered or unexported fields
}

InstalledSkill represents a skill that is already installed on the system.

func DetectAnyExistingSkill added in v0.4.0

func DetectAnyExistingSkill() *InstalledSkill

DetectAnyExistingSkill checks returns the first existing skill it finds from any known agent, starting with locally install skills, or nil if none are found.

func (*InstalledSkill) MatchesKnownVersion added in v0.4.0

func (e *InstalledSkill) MatchesKnownVersion() (*KnownSkillMatch, bool)

MatchesKnownVersion checks if the existing skill is from a known version.

func (*InstalledSkill) Path added in v0.4.0

func (e *InstalledSkill) Path() string

Path returns the original path of the installed skill file.

func (*InstalledSkill) ReinstallCommand added in v0.4.0

func (e *InstalledSkill) ReinstallCommand() string

ReinstallCommand returns the command to reinstall the existing skill.

func (*InstalledSkill) ResolvePath added in v0.4.0

func (e *InstalledSkill) ResolvePath() (string, error)

ResolvePath follows any symlinks and returns the absolute path of the ultimate target file.

type KnownSkillMatch added in v0.4.0

type KnownSkillMatch struct {
	Version string
	Hash    string
}

KnownSkillMatch contains information about a known version of an installed skill.

type Migration added in v0.4.0

type Migration struct {
	// contains filtered or unexported fields
}

Migration represents an ongoing migration process, including a channel to signal completion and a slice to store results.

func StartMigration added in v0.4.0

func StartMigration(ctx context.Context) *Migration

StartMigration will attempt to migrate all installed skills for all agents to the latest known version. Call this function only once per execution.

func (*Migration) Wait added in v0.4.0

func (m *Migration) Wait(ctx context.Context) ([]MigrationResult, error)

Wait waits for the migration process to complete and returns all MigrationResults or an error if the context is canceled.

type MigrationResult added in v0.4.0

type MigrationResult struct {
	SkillPath       string
	FailedReason    error
	PreviousVersion string
}

MigrationResult is the result of attempting to migrate an installed skill, including any potential failure reason, and the previous version if successful.

Jump to

Keyboard shortcuts

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