1
0

完成一个简易的全局skill、command管理器

This commit is contained in:
2026-02-25 14:33:56 +08:00
parent f4cb809f9d
commit 2d327b5af8
60 changed files with 6053 additions and 1 deletions

View File

@@ -0,0 +1,55 @@
package main
import (
"fmt"
"os"
"github.com/spf13/cobra"
"skillmgr/internal/config"
)
var rootCmd = &cobra.Command{
Use: "skillmgr",
Short: "AI 编程平台 skills 和 commands 管理工具",
Long: `skillmgr 是一个用于管理和分发 AI 编程平台 skills 和 commands 的命令行工具。
支持从 git 仓库拉取 skills/commands并根据目标平台Claude Code、OpenCode
将其安装到全局目录或项目目录中。
示例:
# 添加源仓库
skillmgr add https://github.com/user/skills --name my-skills
# 安装 skill
skillmgr install skill lyxy-kb --platform claude --global
# 列出已安装
skillmgr list
# 更新
skillmgr update skill lyxy-kb --platform claude --global
# 卸载
skillmgr uninstall skill lyxy-kb --platform claude --global`,
}
// Execute 执行根命令
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
func init() {
// 初始化配置目录
cobra.OnInitialize(initConfig)
}
func initConfig() {
if err := config.EnsureConfigDirs(); err != nil {
fmt.Fprintf(os.Stderr, "初始化配置目录失败: %v\n", err)
os.Exit(1)
}
}