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

Function newTaskExecutionCommand

internal/cli/task.go:1298–1329  ·  view source on GitHub ↗
(
	deps commandDeps,
	use string,
	short string,
	execute func(context.Context, DaemonClient, string, TaskExecutionRequest) (TaskExecutionRecord, error),
)

Source from the content-addressed store, hash-verified

1296}
1297
1298func newTaskExecutionCommand(
1299 deps commandDeps,
1300 use string,
1301 short string,
1302 execute func(context.Context, DaemonClient, string, TaskExecutionRequest) (TaskExecutionRecord, error),
1303) *cobra.Command {
1304 var input taskExecutionInput
1305 cmd := &cobra.Command{
1306 Use: use,
1307 Short: short,
1308 Args: exactOneNonBlankArg(),
1309 RunE: func(cmd *cobra.Command, args []string) error {
1310 client, err := clientFromDeps(deps)
1311 if err != nil {
1312 return err
1313 }
1314 request, err := buildTaskExecutionRequest(cmd, input)
1315 if err != nil {
1316 return err
1317 }
1318 execution, err := execute(cmd.Context(), client, args[0], request)
1319 if err != nil {
1320 return err
1321 }
1322 return writeCommandOutput(cmd, taskExecutionBundle(&execution))
1323 },
1324 }
1325 cmd.Flags().StringVar(&input.IdempotencyKey, "idempotency-key", "", "Optional idempotency key")
1326 cmd.Flags().StringVar(&input.NetworkRaw, "channel", "", "Optional run channel override")
1327 cmd.Flags().StringVar(&input.MetadataRaw, "metadata", "", "Optional run metadata JSON")
1328 return cmd
1329}
1330
1331func buildTaskExecutionRequest(
1332 cmd *cobra.Command,

Callers 3

newTaskPublishCommandFunction · 0.85
newTaskStartCommandFunction · 0.85
newTaskApproveCommandFunction · 0.85

Calls 5

exactOneNonBlankArgFunction · 0.85
clientFromDepsFunction · 0.85
writeCommandOutputFunction · 0.85
taskExecutionBundleFunction · 0.85

Tested by

no test coverage detected