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,53 @@
package main
import (
"fmt"
"github.com/spf13/cobra"
"skillmgr/internal/installer"
"skillmgr/internal/types"
)
var uninstallCmd = &cobra.Command{
Use: "uninstall <type> <name>",
Short: "卸载 skill 或 command",
Long: `卸载已安装的 skill 或 command。
类型: skill, command
示例:
skillmgr uninstall skill lyxy-kb --platform claude --global
skillmgr uninstall command lyxy-kb --platform opencode`,
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
itemType := args[0]
name := args[1]
platformStr, _ := cmd.Flags().GetString("platform")
global, _ := cmd.Flags().GetBool("global")
platform := types.Platform(platformStr)
scope := types.ScopeProject
if global {
scope = types.ScopeGlobal
}
switch itemType {
case "skill":
return installer.UninstallSkill(name, platform, scope)
case "command":
return installer.UninstallCommand(name, platform, scope)
default:
return fmt.Errorf("无效的类型: %s必须是 'skill' 或 'command'", itemType)
}
},
}
func init() {
uninstallCmd.Flags().StringP("platform", "p", "", "目标平台 (claude|opencode)")
uninstallCmd.Flags().BoolP("global", "g", false, "全局卸载")
uninstallCmd.MarkFlagRequired("platform")
rootCmd.AddCommand(uninstallCmd)
}