1
0
Files
Skill/manager/cmd/skillmgr/root.go

56 lines
1.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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)
}
}