Documentation
¶
Index ¶
- func BuildLearnPrompt(ctx LearnContext) string
- func BuildLearnUpdatePrompt(ctx LearnContext) string
- func BuildNewSkillPrompt(description string) string
- func DefaultSkillDirs() []string
- func ExtractSkillName(content string) string
- func FormatAuditResult(r AuditResult) string
- func FormatLearnSummary(ctx LearnContext, deep bool) string
- func FormatRating(rating int) string
- func FormatSkillEntry(e SkillEntry) string
- func FormatSkillInfo(s SmartSkill, path string) string
- func FormatSkillsForPrompt(skills []SmartSkill) string
- func GatherDeepSourceInfo(dir string) string
- func Install(srcDir string) error
- func Remove(name string) error
- func RunAutoSkill(dir string) (string, error)
- func SaveNewSkill(name, content string) (string, error)
- func StripDangerousChars(content string) string
- func Summary() string
- func Uninstall(name string) error
- type AuditFinding
- type AuditResult
- type AuditSeverity
- type CommandDef
- type FeedbackStore
- type HookDef
- type LearnContext
- type Manifest
- type ProjectSignal
- type RegistryClient
- func (rc *RegistryClient) FetchIndex() (*SkillIndex, error)
- func (rc *RegistryClient) Info(name string) (*SkillEntry, error)
- func (rc *RegistryClient) Install(repo, skillName, scope string) (string, error)
- func (rc *RegistryClient) Search(query, category string) ([]SkillEntry, error)
- func (rc *RegistryClient) Trending(limit int) ([]SkillEntry, error)
- type Runtime
- type SkillEntry
- type SkillIndex
- type SkillRating
- type SkillSource
- type SmartSkill
- func InstalledSkillInfo(name string) (SmartSkill, string, bool)
- func LoadSmartSkills(dirs []string) []SmartSkill
- func MatchSkillsByContext(skills []SmartSkill, userPrompt string) []SmartSkill
- func MatchSkillsByPath(skills []SmartSkill, activePath string) []SmartSkill
- func ParseSmartSkillPublic(content string) SmartSkill
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildLearnPrompt ¶
func BuildLearnPrompt(ctx LearnContext) string
BuildLearnPrompt creates the LLM prompt for skill recommendation.
func BuildLearnUpdatePrompt ¶
func BuildLearnUpdatePrompt(ctx LearnContext) string
BuildLearnUpdatePrompt creates a prompt to re-analyze installed skills for staleness.
func BuildNewSkillPrompt ¶
BuildNewSkillPrompt creates an LLM prompt for the skill creator wizard.
func DefaultSkillDirs ¶
func DefaultSkillDirs() []string
DefaultSkillDirs returns directories to scan for SKILL.md files. Includes hawk's own paths plus cross-agent standard paths for interoperability. Follows the agentskills.io spec and supports gh skill install placement.
func ExtractSkillName ¶
ExtractSkillName tries to extract the skill name from generated SKILL.md content.
func FormatAuditResult ¶
func FormatAuditResult(r AuditResult) string
FormatAuditResult formats audit findings for display.
func FormatLearnSummary ¶
func FormatLearnSummary(ctx LearnContext, deep bool) string
FormatLearnSummary creates a display header for the /learn command.
func FormatRating ¶
FormatRating returns a star string like "★★★☆☆".
func FormatSkillEntry ¶
func FormatSkillEntry(e SkillEntry) string
FormatSkillEntry formats a registry entry for display.
func FormatSkillInfo ¶
func FormatSkillInfo(s SmartSkill, path string) string
FormatSkillInfo formats detailed skill info for display.
func FormatSkillsForPrompt ¶
func FormatSkillsForPrompt(skills []SmartSkill) string
FormatSkillsForPrompt formats matched skills into text suitable for injection into the system prompt.
func GatherDeepSourceInfo ¶
GatherDeepSourceInfo reads key source files to provide richer context.
func RunAutoSkill ¶
RunAutoSkill analyzes the project and installs recommended skills.
func SaveNewSkill ¶
SaveNewSkill writes a SKILL.md to the project skills directory.
func StripDangerousChars ¶
StripDangerousChars removes dangerous Unicode characters from content.
Types ¶
type AuditFinding ¶
type AuditFinding struct {
File string
Line int
Column int
Severity AuditSeverity
Category string
Message string
Char rune
}
AuditFinding is a single security issue found in a skill file.
func AuditSkillFile ¶
func AuditSkillFile(path string) ([]AuditFinding, error)
AuditSkillFile scans a single file for dangerous Unicode characters.
type AuditResult ¶
type AuditResult struct {
Findings []AuditFinding
Files int
}
AuditResult is the result of scanning one or more skill files.
func AuditSkillDir ¶
func AuditSkillDir(dir string) AuditResult
AuditSkillDir scans all SKILL.md files in a directory tree.
type AuditSeverity ¶
type AuditSeverity string
AuditSeverity indicates how dangerous a finding is.
const ( SeverityCritical AuditSeverity = "CRITICAL" SeverityWarning AuditSeverity = "WARNING" SeverityInfo AuditSeverity = "INFO" )
type CommandDef ¶
type CommandDef struct {
Name string `json:"name"`
Description string `json:"description"`
Script string `json:"script,omitempty"`
}
CommandDef defines a plugin-provided command.
type FeedbackStore ¶
type FeedbackStore struct {
// contains filtered or unexported fields
}
FeedbackStore manages skill ratings persisted to disk.
func NewFeedbackStore ¶
func NewFeedbackStore() *FeedbackStore
NewFeedbackStore creates a store at ~/.hawk/feedback.json.
func NewFeedbackStoreAt ¶
func NewFeedbackStoreAt(path string) *FeedbackStore
NewFeedbackStoreAt creates a store at a custom path (for testing).
func (*FeedbackStore) Get ¶
func (fs *FeedbackStore) Get(skill string) (SkillRating, bool)
Get returns the rating for a skill, or 0 if not rated.
func (*FeedbackStore) List ¶
func (fs *FeedbackStore) List() []SkillRating
List returns all ratings.
type LearnContext ¶
type LearnContext struct {
Signals []ProjectSignal
Installed []SmartSkill
Registry []SkillEntry
SourceInfo string // populated by /learn deep
}
LearnContext holds project analysis data for the LLM advisor.
func GatherLearnContext ¶
func GatherLearnContext(dir string) LearnContext
GatherLearnContext collects project info for the advisor.
type Manifest ¶
type Manifest struct {
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description,omitempty"`
Author string `json:"author,omitempty"`
Commands []CommandDef `json:"commands,omitempty"`
Skills []string `json:"skills,omitempty"`
Hooks []HookDef `json:"hooks,omitempty"`
}
Manifest defines a hawk plugin.
func LoadManifest ¶
LoadManifest loads a plugin manifest from a directory.
type ProjectSignal ¶
type ProjectSignal struct {
Category string // language, framework, pattern, tool
Name string // e.g. "go", "react", "docker"
}
ProjectSignal represents a detected project characteristic.
func AnalyzeProject ¶
func AnalyzeProject(dir string) []ProjectSignal
AnalyzeProject scans the current directory for project signals.
type RegistryClient ¶
type RegistryClient struct {
IndexURL string
CacheDir string
// contains filtered or unexported fields
}
RegistryClient fetches and queries the community skill registry.
func NewRegistryClient ¶
func NewRegistryClient() *RegistryClient
NewRegistryClient creates a registry client with sensible defaults.
func (*RegistryClient) FetchIndex ¶
func (rc *RegistryClient) FetchIndex() (*SkillIndex, error)
FetchIndex downloads the registry index, using a local cache when fresh.
func (*RegistryClient) Info ¶
func (rc *RegistryClient) Info(name string) (*SkillEntry, error)
Info returns detailed information about a specific skill.
func (*RegistryClient) Install ¶
func (rc *RegistryClient) Install(repo, skillName, scope string) (string, error)
Install clones a specific skill from a GitHub repo into the skills directory. If skillName is empty, all skills in the repo are installed.
func (*RegistryClient) Search ¶
func (rc *RegistryClient) Search(query, category string) ([]SkillEntry, error)
Search filters skills by query string and optional category.
func (*RegistryClient) Trending ¶
func (rc *RegistryClient) Trending(limit int) ([]SkillEntry, error)
Trending returns the most-installed skills.
type Runtime ¶
type Runtime struct {
SmartSkills []SmartSkill
// contains filtered or unexported fields
}
Runtime manages loaded plugins and their execution.
func (*Runtime) CommandList ¶
func (r *Runtime) CommandList() []CommandDef
CommandList returns all available plugin commands.
func (*Runtime) ExecuteCommand ¶
ExecuteCommand runs a plugin command.
func (*Runtime) ListPlugins ¶
ListPlugins returns all loaded plugin manifests.
func (*Runtime) RegisterHooks ¶
func (r *Runtime) RegisterHooks()
RegisterHooks registers all plugin hooks with the hook registry.
type SkillEntry ¶
type SkillEntry struct {
Name string `json:"name"`
Description string `json:"description"`
Author string `json:"author"`
Repo string `json:"repo"`
Path string `json:"path"`
Category string `json:"category"`
Tags []string `json:"tags"`
Version string `json:"version"`
License string `json:"license"`
Agents []string `json:"agents"`
Installs int `json:"installs"`
UpdatedAt string `json:"updated_at"`
}
SkillEntry is a single skill in the registry index.
func RecommendSkills ¶
func RecommendSkills(signals []ProjectSignal, skills []SkillEntry) []SkillEntry
RecommendSkills matches project signals against the registry index.
type SkillIndex ¶
type SkillIndex struct {
Version int `json:"version"`
UpdatedAt string `json:"updated_at"`
Skills []SkillEntry `json:"skills"`
}
SkillIndex is the full registry index.
type SkillRating ¶
type SkillRating struct {
Skill string `json:"skill"`
Rating int `json:"rating"` // 1-5
Comment string `json:"comment,omitempty"`
Date time.Time `json:"date"`
}
SkillRating stores a user's rating for a skill.
type SkillSource ¶
type SkillSource struct {
Repo string `json:"repo,omitempty"`
Ref string `json:"ref,omitempty"`
InstalledAt string `json:"installed_at,omitempty"`
}
SkillSource tracks where an installed skill came from.
type SmartSkill ¶
type SmartSkill struct {
Name string
Description string // used for auto-matching against user prompts
Paths []string // glob patterns that trigger this skill
Content string // skill prompt content (body of SKILL.md)
AutoInvoke bool // if true, model can trigger without user /command
Compatibility string // environment requirements (per spec)
AllowedTools string // pre-approved tools, space-separated (per spec)
Version string // semver for update tracking
Author string // skill author
License string // license identifier (MIT, Apache-2.0, etc.)
Category string // engineering, ops, testing, security, devtools, workflow
Tags []string // discovery tags
Agents []string // cross-agent compatibility (hawk, claude-code, etc.)
Source SkillSource
}
SmartSkill is a skill that can be auto-invoked based on file paths or user prompt context. Follows the Agent Skills spec (agentskills.io).
func InstalledSkillInfo ¶
func InstalledSkillInfo(name string) (SmartSkill, string, bool)
InstalledSkillInfo returns source metadata for an installed skill.
func LoadSmartSkills ¶
func LoadSmartSkills(dirs []string) []SmartSkill
LoadSmartSkills scans the given directories for SKILL.md files with YAML frontmatter and returns the parsed skills.
Frontmatter format:
--- name: api-review description: Reviews API endpoints for consistency paths: ["src/api/**", "routes/**"] auto-invoke: true ---
func MatchSkillsByContext ¶
func MatchSkillsByContext(skills []SmartSkill, userPrompt string) []SmartSkill
MatchSkillsByContext returns skills whose Description keywords appear in the user prompt. Uses simple case-insensitive word overlap.
func MatchSkillsByPath ¶
func MatchSkillsByPath(skills []SmartSkill, activePath string) []SmartSkill
MatchSkillsByPath returns skills whose Paths glob patterns match activePath.
func ParseSmartSkillPublic ¶
func ParseSmartSkillPublic(content string) SmartSkill
ParseSmartSkillPublic is the exported version of parseSmartSkill.