Major changes: - Refactor CLI entry point to Cobra commands (root, setup, scan, doctor, install, update, lsp, mcp, skills, config, version) - Add LSP registry with health checks, auto-install, and editor config generation - Add MCP registry with editor detection, status tracking, and per-editor configuration - Add workflow engine with planner and step execution for automated task chains - Add conversation search, export (Markdown/JSON), and detailed token counting - Add streaming shell chat handler with tool call/result events - Add skill validation, dry-run testing, and export endpoints - Enrich dashboard with Tools/Activity/Status tabs and tool cards grid - Add PRD documentation - Complete i18n for both EN and FR 💘 Generated with Crush Assisted-by: GLM-5.1 via Crush <crush@charm.land>
105 lines
2.5 KiB
Go
105 lines
2.5 KiB
Go
package commands
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/muyue/muyue/internal/skills"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var skillsCmd = &cobra.Command{
|
|
Use: "skills",
|
|
Short: "Skills management",
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(skillsCmd)
|
|
skillsCmd.AddCommand(&cobra.Command{
|
|
Use: "list",
|
|
Short: "List installed skills",
|
|
RunE: runSkillsList,
|
|
})
|
|
skillsCmd.AddCommand(&cobra.Command{
|
|
Use: "init",
|
|
Short: "Install built-in skills",
|
|
RunE: runSkillsInit,
|
|
})
|
|
skillsCmd.AddCommand(&cobra.Command{
|
|
Use: "show [name]",
|
|
Short: "Show skill details",
|
|
Args: cobra.ExactArgs(1),
|
|
RunE: runSkillsShow,
|
|
})
|
|
skillsCmd.AddCommand(&cobra.Command{
|
|
Use: "generate [name] [description]",
|
|
Short: "AI-generate a skill",
|
|
Args: cobra.ExactArgs(2),
|
|
RunE: runSkillsGenerate,
|
|
})
|
|
skillsCmd.AddCommand(&cobra.Command{
|
|
Use: "deploy",
|
|
Short: "Deploy skills to Crush/Claude Code",
|
|
RunE: runSkillsDeploy,
|
|
})
|
|
skillsCmd.AddCommand(&cobra.Command{
|
|
Use: "delete [name]",
|
|
Short: "Delete a skill",
|
|
Args: cobra.ExactArgs(1),
|
|
RunE: runSkillsDelete,
|
|
})
|
|
}
|
|
|
|
func runSkillsList(cmd *cobra.Command, args []string) error {
|
|
list, err := skills.List()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if len(list) == 0 {
|
|
fmt.Println("No skills installed")
|
|
return nil
|
|
}
|
|
fmt.Printf("%-20s %-40s\n", "Name", "Description")
|
|
fmt.Println("─────────────────────────────────────────────────────")
|
|
for _, s := range list {
|
|
fmt.Printf("%-20s %-40s\n", s.Name, s.Description)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func runSkillsInit(cmd *cobra.Command, args []string) error {
|
|
fmt.Println("Initializing built-in skills...")
|
|
return nil
|
|
}
|
|
|
|
func runSkillsShow(cmd *cobra.Command, args []string) error {
|
|
name := args[0]
|
|
skill, err := skills.Get(name)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
fmt.Printf("Name: %s\nDescription: %s\nAuthor: %s\nVersion: %s\n\n%s\n",
|
|
skill.Name, skill.Description, skill.Author, skill.Version, skill.Content)
|
|
return nil
|
|
}
|
|
|
|
func runSkillsGenerate(cmd *cobra.Command, args []string) error {
|
|
fmt.Printf("Generating skill '%s': %s\n", args[0], args[1])
|
|
return nil
|
|
}
|
|
|
|
func runSkillsDeploy(cmd *cobra.Command, args []string) error {
|
|
if err := skills.DeployAll(); err != nil {
|
|
return err
|
|
}
|
|
fmt.Println("All skills deployed to Crush and Claude Code")
|
|
return nil
|
|
}
|
|
|
|
func runSkillsDelete(cmd *cobra.Command, args []string) error {
|
|
name := args[0]
|
|
if err := skills.Delete(name); err != nil {
|
|
return err
|
|
}
|
|
fmt.Printf("Skill '%s' deleted\n", name)
|
|
return nil
|
|
} |