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

Function newTaskRunAttachSessionCommand

internal/cli/task.go:2522–2554  ·  view source on GitHub ↗
(deps commandDeps)

Source from the content-addressed store, hash-verified

2520}
2521
2522func newTaskRunAttachSessionCommand(deps commandDeps) *cobra.Command {
2523 var sessionID string
2524
2525 cmd := &cobra.Command{
2526 Use: "attach-session <run-id>",
2527 Short: "Attach an existing session to a claimed or starting run",
2528 Args: exactOneNonBlankArg(),
2529 RunE: func(cmd *cobra.Command, args []string) error {
2530 client, err := clientFromDeps(deps)
2531 if err != nil {
2532 return err
2533 }
2534 if strings.TrimSpace(sessionID) == "" {
2535 return errors.New("cli: --session is required")
2536 }
2537
2538 run, err := client.AttachTaskRunSession(
2539 cmd.Context(),
2540 args[0],
2541 AttachTaskRunSessionRequest{
2542 SessionID: strings.TrimSpace(sessionID),
2543 },
2544 )
2545 if err != nil {
2546 return err
2547 }
2548 return writeCommandOutput(cmd, taskRunBundle(run))
2549 },
2550 }
2551 cmd.Flags().StringVar(&sessionID, "session", "", "Existing session ID to attach")
2552 mustMarkFlagRequired(cmd, "session")
2553 return cmd
2554}
2555
2556func newTaskRunCompleteCommand(deps commandDeps) *cobra.Command {
2557 var resultRaw string

Callers 1

newTaskRunCommandFunction · 0.85

Calls 6

exactOneNonBlankArgFunction · 0.85
clientFromDepsFunction · 0.85
writeCommandOutputFunction · 0.85
taskRunBundleFunction · 0.85
mustMarkFlagRequiredFunction · 0.85
AttachTaskRunSessionMethod · 0.65

Tested by

no test coverage detected