Skip to content

[plan] Add Confirm field for file overwrite in interactive workflow builder #7217

@github-actions

Description

@github-actions

Objective

Replace the error-based file overwrite handling with an interactive confirmation dialog using huh.NewConfirm().

Context

Currently, if a workflow file already exists, the interactive builder returns an error unless the --force flag is used. This interrupts the user flow and requires restarting the entire interactive session.

Approach

Add a Confirm field that asks the user whether to overwrite when a file exists:

if _, err := os.Stat(destFile); err == nil && !force {
    var overwrite bool
    huh.NewConfirm().
        Title(fmt.Sprintf("Workflow file '%s' already exists. Overwrite?", filepath.Base(destFile))).
        Affirmative("Yes, overwrite").
        Negative("No, cancel").
        Value(&overwrite).
        WithAccessible(isAccessibleMode()).
        Run()
    if !overwrite {
        return fmt.Errorf("workflow creation cancelled")
    }
}

Files to Modify

  • Update: pkg/cli/interactive.go - Add confirmation logic in the file write section

Acceptance Criteria

  • When a workflow file exists, users see an interactive confirmation prompt
  • Selecting "Yes, overwrite" proceeds with file creation
  • Selecting "No, cancel" exits gracefully with a clear message
  • Confirmation works in both accessible and standard modes
  • The --force flag still bypasses the confirmation when used
    Related to [plan] Enhance interactive workflow builder with huh v0.7.0+ features #7216

AI generated by Plan Command for discussion #7214

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions