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

Function newSkillActionCommand

internal/cli/skill_commands.go:440–482  ·  view source on GitHub ↗
(
	deps commandDeps,
	use string,
	short string,
	action func(context.Context, DaemonClient, string, SkillQuery) (SkillActionRecord, error),
)

Source from the content-addressed store, hash-verified

438}
439
440func newSkillActionCommand(
441 deps commandDeps,
442 use string,
443 short string,
444 action func(context.Context, DaemonClient, string, SkillQuery) (SkillActionRecord, error),
445) *cobra.Command {
446 var workspaceRef string
447 var agentName string
448 cmd := &cobra.Command{
449 Use: use,
450 Short: short,
451 Args: exactOneNonBlankArg(),
452 RunE: func(cmd *cobra.Command, args []string) error {
453 scope, err := resolveSkillCommandScope(
454 cmd.Context(),
455 cmd,
456 deps,
457 agentActionCLI("skill."+strings.Fields(use)[0]),
458 )
459 if err != nil {
460 return err
461 }
462 client, err := clientFromDeps(deps)
463 if err != nil {
464 return err
465 }
466 actionName := strings.Fields(use)[0]
467 result, err := action(
468 cmd.Context(),
469 client,
470 args[0],
471 scope.query,
472 )
473 if err != nil {
474 return err
475 }
476 return writeCommandOutput(cmd, skillActionBundle(args[0], actionName, result))
477 },
478 }
479 cmd.Flags().StringVar(&workspaceRef, workspaceSkillSource, "", "Workspace id, name, or path")
480 cmd.Flags().StringVar(&agentName, "for-agent", "", "Resolve the effective skill set for one logical agent")
481 return cmd
482}
483
484func newSkillSearchCommand(deps commandDeps) *cobra.Command {
485 limit := defaultMarketplaceSearchLim

Callers 2

newSkillEnableCommandFunction · 0.85
newSkillDisableCommandFunction · 0.85

Calls 6

exactOneNonBlankArgFunction · 0.85
resolveSkillCommandScopeFunction · 0.85
agentActionCLIFunction · 0.85
clientFromDepsFunction · 0.85
writeCommandOutputFunction · 0.85
skillActionBundleFunction · 0.85

Tested by

no test coverage detected