MCPcopy Create free account
hub / github.com/compozy/agh / newSkillListCommand

Function newSkillListCommand

internal/cli/skill_commands.go:45–110  ·  view source on GitHub ↗
(deps commandDeps)

Source from the content-addressed store, hash-verified

43}
44
45func newSkillListCommand(deps commandDeps) *cobra.Command {
46 var sourceFilter string
47 var workspace string
48 var agentName string
49
50 cmd := &cobra.Command{
51 Use: skillCommandsListKey,
52 Short: "List locally available skills",
53 Example: ` # List every skill visible in the current workspace
54 agh skill list
55
56 # Show only bundled skills
57 agh skill list --source bundled`,
58 Args: cobra.NoArgs,
59 RunE: func(cmd *cobra.Command, _ []string) error {
60 scope, err := resolveSkillCommandScope(cmd.Context(), cmd, deps, agentActionCLI("skill.list"))
61 if err != nil {
62 return err
63 }
64 if scope.useDaemon {
65 client, err := clientFromDeps(deps)
66 if err != nil {
67 return err
68 }
69 records, err := client.ListSkills(
70 cmd.Context(),
71 scope.query,
72 )
73 if err != nil {
74 return err
75 }
76 items, err := skillListItemsFromRecords(records, sourceFilter)
77 if err != nil {
78 return err
79 }
80 return writeCommandOutput(cmd, skillListBundle(items))
81 }
82
83 ctx, err := loadSkillCommandContext(cmd.Context(), deps, scope.query.ForAgent)
84 if err != nil {
85 return err
86 }
87
88 items, err := skillListItems(ctx.skills, sourceFilter)
89 if err != nil {
90 return err
91 }
92
93 return writeCommandOutput(cmd, skillListBundle(items))
94 },
95 }
96 cmd.Flags().StringVar(
97 &sourceFilter,
98 "source",
99 "",
100 "Filter by source: bundled, marketplace, user, additional, workspace, or agent-local",
101 )
102 cmd.Flags().StringVar(

Calls 9

resolveSkillCommandScopeFunction · 0.85
agentActionCLIFunction · 0.85
clientFromDepsFunction · 0.85
writeCommandOutputFunction · 0.85
skillListBundleFunction · 0.85
loadSkillCommandContextFunction · 0.85
skillListItemsFunction · 0.85
ListSkillsMethod · 0.65