-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Labels
Description
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
--forceflag 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
Copilot