( deps commandDeps, use string, short string, action func(context.Context, DaemonClient, string, SkillQuery) (SkillActionRecord, error), )
| 438 | } |
| 439 | |
| 440 | func 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 | |
| 484 | func newSkillSearchCommand(deps commandDeps) *cobra.Command { |
| 485 | limit := defaultMarketplaceSearchLim |
no test coverage detected