完成一个简易的全局skill、command管理器
This commit is contained in:
71
manager/internal/types/types.go
Normal file
71
manager/internal/types/types.go
Normal file
@@ -0,0 +1,71 @@
|
||||
package types
|
||||
|
||||
import "time"
|
||||
|
||||
// Platform 平台类型
|
||||
type Platform string
|
||||
|
||||
const (
|
||||
PlatformClaude Platform = "claude"
|
||||
PlatformOpenCode Platform = "opencode"
|
||||
)
|
||||
|
||||
// ItemType 安装项类型
|
||||
type ItemType string
|
||||
|
||||
const (
|
||||
ItemTypeSkill ItemType = "skill"
|
||||
ItemTypeCommand ItemType = "command"
|
||||
)
|
||||
|
||||
// Scope 安装作用域
|
||||
type Scope string
|
||||
|
||||
const (
|
||||
ScopeGlobal Scope = "global"
|
||||
ScopeProject Scope = "project"
|
||||
)
|
||||
|
||||
// Repository 源仓库配置
|
||||
type Repository struct {
|
||||
Name string `json:"name"`
|
||||
URL string `json:"url"`
|
||||
Branch string `json:"branch"`
|
||||
AddedAt time.Time `json:"added_at"`
|
||||
}
|
||||
|
||||
// RepositoryConfig 仓库配置文件结构
|
||||
type RepositoryConfig struct {
|
||||
Repositories []Repository `json:"repositories"`
|
||||
}
|
||||
|
||||
// InstallRecord 安装记录
|
||||
type InstallRecord struct {
|
||||
Type ItemType `json:"type"`
|
||||
Name string `json:"name"`
|
||||
SourceRepo string `json:"source_repo"`
|
||||
Platform Platform `json:"platform"`
|
||||
Scope Scope `json:"scope"`
|
||||
InstallPath string `json:"install_path"`
|
||||
InstalledAt time.Time `json:"installed_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
// InstallConfig 安装配置文件结构
|
||||
type InstallConfig struct {
|
||||
Installations []InstallRecord `json:"installations"`
|
||||
}
|
||||
|
||||
// SkillMetadata skill 元数据(从 SKILL.md frontmatter 解析)
|
||||
type SkillMetadata struct {
|
||||
Name string
|
||||
Description string
|
||||
SourceRepo string
|
||||
}
|
||||
|
||||
// CommandGroup 命令组信息
|
||||
type CommandGroup struct {
|
||||
Name string // 命令组名称(目录名)
|
||||
Files []string // 命令文件列表
|
||||
SourceRepo string // 来源仓库
|
||||
}
|
||||
Reference in New Issue
Block a user