finalize cline task send according to spec - adds yolo flag and instance check (#6843)
* adding the yolo flags * do not create an instance on send, if one doesn't already exist
This commit is contained in:
1 parent
ec6daccf5f
commit
3288defb67
1 file changed
+27
@@ -278,6 +278,7 @@ func NewTaskSendCommand() *cobra.Command {
|
||||
mode string
|
||||
approve bool
|
||||
deny bool
|
||||
yolo bool
|
||||
)
|
||||
|
||||
cmd := &cobra.Command{
|
||||
@@ -289,6 +290,12 @@ func NewTaskSendCommand() *cobra.Command {
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
ctx := cmd.Context()
|
||||
|
||||
// Check if an instance exists when no address specified
|
||||
if address == "" && global.Clients.GetRegistry().GetDefaultInstance() == "" {
|
||||
fmt.Println("No instances available for sending messages")
|
||||
return nil
|
||||
}
|
||||
|
||||
// Get content from both args and stdin
|
||||
message, err := getContentFromStdinAndArgs(args)
|
||||
if err != nil {
|
||||
@@ -328,6 +335,24 @@ func NewTaskSendCommand() *cobra.Command {
|
||||
return fmt.Errorf("failed to check if message can be sent: %w", err)
|
||||
}
|
||||
|
||||
// Process yolo flag and apply settings
|
||||
if yolo {
|
||||
settings := []string{"yolo_mode_toggled=true"}
|
||||
parsedSettings, secrets, err := task.ParseTaskSettings(settings)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to parse settings: %w", err)
|
||||
}
|
||||
|
||||
configManager, err := config.NewManager(ctx, taskManager.GetCurrentInstance())
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create config manager: %w", err)
|
||||
}
|
||||
|
||||
if err := configManager.UpdateSettings(ctx, parsedSettings, secrets); err != nil {
|
||||
return fmt.Errorf("failed to apply settings: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
if mode != "" {
|
||||
if err := taskManager.SetModeAndSendMessage(ctx, mode, message, images, files); err != nil {
|
||||
return fmt.Errorf("failed to set mode and send message: %w", err)
|
||||
@@ -361,6 +386,8 @@ func NewTaskSendCommand() *cobra.Command {
|
||||
cmd.Flags().StringVarP(&mode, "mode", "m", "", "mode (act|plan)")
|
||||
cmd.Flags().BoolVarP(&approve, "approve", "a", false, "approve pending request")
|
||||
cmd.Flags().BoolVarP(&deny, "deny", "d", false, "deny pending request")
|
||||
cmd.Flags().BoolVarP(&yolo, "yolo", "y", false, "enable yolo mode (non-interactive)")
|
||||
cmd.Flags().BoolVar(&yolo, "no-interactive", false, "enable yolo mode (non-interactive)")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user