Documentation
¶
Index ¶
- Constants
- func GetInstallHelpMessage() string
- func GlobalSkillsDir() string
- type ClawHubSource
- type Entry
- type GitHubSource
- type InstallResult
- type Installer
- func (i *Installer) InstallFromClawHub(source ClawHubSource) (*InstallResult, error)
- func (i *Installer) InstallFromGitHub(source GitHubSource) (int, error)
- func (i *Installer) InstallIfNeeded() error
- func (i *Installer) InstallOfficialSkills() error
- func (i *Installer) InstallRepoSkills(repo OfficialRepo) (int, error)
- func (i *Installer) InstallSingleFile(source GitHubSource) error
- func (i *Installer) InstallSubPath(source GitHubSource) error
- func (i *Installer) IsFirstRun() bool
- func (i *Installer) ListInstalledSkills() ([]string, error)
- type NetworkError
- type OfficialRepo
- type RecommendedSource
- type StateManager
Constants ¶
const ( // AnthricSkillsRepo 官方 skills 仓库 AnthricSkillsRepo = "anthropics/skills" // PlaywrightSkillsRepo Microsoft Playwright CLI skills 仓库 PlaywrightSkillsRepo = "microsoft/playwright-cli" // DefaultSkillsBranch 默认分支 DefaultSkillsBranch = "main" // SkillsInstallMarker 安装标记文件 SkillsInstallMarker = ".official_skills_installed" )
const DefaultClawHubRegistry = "https://clawhub.ai"
Variables ¶
This section is empty.
Functions ¶
func GetInstallHelpMessage ¶
func GetInstallHelpMessage() string
GetInstallHelpMessage 获取安装帮助信息(网络失败时显示)
func GlobalSkillsDir ¶
func GlobalSkillsDir() string
GlobalSkillsDir 返回全局 skills 目录 (~/.agents/skills/) 这是业界标准路径,可被多个 AI 工具共享
Types ¶
type ClawHubSource ¶
func ParseClawHubSource ¶
func ParseClawHubSource(raw string) (ClawHubSource, error)
type Entry ¶
type Entry struct {
Name string
DisplayName string
Description string
Path string
Body string
Source string // "workspace" or "global"
}
Entry is a single skill document discovered from workspace/skills.
func Discover ¶
Discover loads markdown skill files from skillsDir. Supported layouts:
- skills/<name>.md
- skills/<name>/SKILL.md
func DiscoverAll ¶
DiscoverAll loads skills from both workspace and global directories. Workspace skills take precedence over global skills (same name = workspace wins).
func FilterByMessage ¶
FilterByMessage returns selected skills based on references in message. Supported selectors:
- @skill:<name>
- $<name>
Special selectors:
- @skill:all / $all
- @skill:none / $none
If no selector is present, all skills are returned.
type GitHubSource ¶
type GitHubSource struct {
Owner string
Repo string
Branch string
Path string
Type string // "file", "dir", "repo"
}
GitHubSource 表示解析后的 GitHub 源信息
type InstallResult ¶
type Installer ¶
type Installer struct {
// contains filtered or unexported fields
}
Installer 负责安装官方 skills
func (*Installer) InstallFromClawHub ¶
func (i *Installer) InstallFromClawHub(source ClawHubSource) (*InstallResult, error)
func (*Installer) InstallFromGitHub ¶
func (i *Installer) InstallFromGitHub(source GitHubSource) (int, error)
InstallFromGitHub 从 GitHub 智能安装技能
func (*Installer) InstallIfNeeded ¶
InstallIfNeeded 如果需要则安装官方 skills(用于自动检测)
func (*Installer) InstallOfficialSkills ¶
InstallOfficialSkills 从 GitHub 或镜像下载并安装所有官方 skills 支持自动 fallback 到可用镜像
func (*Installer) InstallRepoSkills ¶
func (i *Installer) InstallRepoSkills(repo OfficialRepo) (int, error)
InstallRepoSkills 安装单个仓库的技能(公开方法) 返回安装的文件数量和可能的错误
func (*Installer) InstallSingleFile ¶
func (i *Installer) InstallSingleFile(source GitHubSource) error
InstallSingleFile 公开方法:从 GitHub 安装单个技能文件
func (*Installer) InstallSubPath ¶
func (i *Installer) InstallSubPath(source GitHubSource) error
InstallSubPath 公开方法:从 GitHub 安装子路径下的所有技能
func (*Installer) IsFirstRun ¶
IsFirstRun 检查是否是首次运行(skills 目录为空或没有官方 skills)
func (*Installer) ListInstalledSkills ¶
ListInstalledSkills 列出已安装的官方 skills
type NetworkError ¶
NetworkError 网络错误类型
func (*NetworkError) Error ¶
func (e *NetworkError) Error() string
func (*NetworkError) Unwrap ¶
func (e *NetworkError) Unwrap() error
type OfficialRepo ¶
type OfficialRepo struct {
Name string
Repo string
SubPath string // 可选:指定子路径,如 "skills/steipete/weather"
}
OfficialRepo 定义官方技能仓库
type RecommendedSource ¶
type RecommendedSource struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Description string `json:"description"`
Source string `json:"source,omitempty"`
BrowseURL string `json:"browseUrl,omitempty"`
Example string `json:"example,omitempty"`
}
func RecommendedSources ¶
func RecommendedSources() []RecommendedSource
type StateManager ¶
type StateManager struct {
// contains filtered or unexported fields
}
StateManager 管理技能的启用/禁用状态
func (*StateManager) FilterEnabled ¶
func (sm *StateManager) FilterEnabled(entries []Entry) []Entry
FilterEnabled 过滤出启用的技能
func (*StateManager) GetAllStates ¶
func (sm *StateManager) GetAllStates() map[string]bool
GetAllStates 获取所有技能状态
func (*StateManager) IsEnabled ¶
func (sm *StateManager) IsEnabled(skillName string) bool
IsEnabled 检查技能是否启用(默认启用)
func (*StateManager) SetEnabled ¶
func (sm *StateManager) SetEnabled(skillName string, enabled bool) error
SetEnabled 设置技能启用状态