Update agent-task create command argument handling

Changed argument parsing to accept a maximum of one argument and assign it directly to ProblemStatement. Added error handling for missing problem statement and removed unused strings import.
This commit is contained in:
Kynan Ware 2025-09-03 10:03:48 -06:00
parent 3574ee9c30
commit a3fa83071d

View file

@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"io"
"strings"
"time"
"github.com/cenkalti/backoff/v4"
@ -35,9 +34,15 @@ func NewCmdCreate(f *cmdutil.Factory, runF func(*CreateOptions) error) *cobra.Co
cmd := &cobra.Command{
Use: "create <problem statement>",
Short: "Create an agent task (preview)",
Args: cobra.MinimumNArgs(1),
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
opts.ProblemStatement = strings.Join(args, " ")
// TODO: We'll support prompting for the problem statement if not provided
// and from file flags, later.
if len(args) == 0 {
return cmdutil.FlagErrorf("a problem statement is required")
}
opts.ProblemStatement = args[0]
// Support -R/--repo override
if f != nil {
opts.BaseRepo = f.BaseRepo