Skip to content

Add --confirm flag to prompt for confirmation before committing#15

Open
abelcha wants to merge 1 commit intocoder:mainfrom
abelcha:add-confirm-flag
Open

Add --confirm flag to prompt for confirmation before committing#15
abelcha wants to merge 1 commit intocoder:mainfrom
abelcha:add-confirm-flag

Conversation

@abelcha
Copy link

@abelcha abelcha commented Oct 29, 2025

Summary

This PR adds a new `--confirm` (or `-y`) flag that allows users to review and confirm the generated commit message before it is actually committed.

Changes

  • Added `confirm` field to `runOptions` struct
  • Added confirmation prompt logic in the `run` function
  • Added `--confirm` flag definition with `-y` shorthand

Usage

```bash

Generate commit message and ask for confirmation before committing

aicommit --confirm

Or using the short flag

aicommit -y
```

Behavior

When the `--confirm` flag is set:

  1. The AI generates the commit message and displays it
  2. User is prompted: `Commit with this message? [Y/n]:`
  3. The commit only proceeds if the user confirms with 'y', 'yes', or by pressing Enter
  4. Responding with 'n' or 'no' cancels the commit

Backward Compatibility

Without the flag, the tool behaves exactly as before, committing directly. This is a purely additive feature with no breaking changes.

This commit adds a new --confirm (-y) flag that allows users to review
and confirm the generated commit message before it is actually committed.

When the flag is set, users are prompted with 'Commit with this message? [Y/n]:'
after the AI generates the commit message. The commit only proceeds if the user
confirms with 'y', 'yes', or by pressing Enter.

This provides an additional safety mechanism for users who want to review
the AI-generated message before it becomes part of their git history.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant