fix(commit): Prevent auto-accept for BREAKING CHANGE commits; require manual confirmation and warn when --yes is used

This commit is contained in:
2025-12-04 11:13:31 +00:00
parent 27f2d265de
commit d508e1d06c
3 changed files with 19 additions and 3 deletions

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@git.zone/cli',
version: '2.2.0',
version: '2.2.1',
description: 'A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.'
}

View File

@@ -30,8 +30,12 @@ export const run = async (argvArg: any) => {
let answerBucket: plugins.smartinteract.AnswerBucket;
// Check if -y or --yes flag is set to auto-accept recommendations
if (argvArg.y || argvArg.yes) {
// Check if -y/--yes flag is set AND version is not a breaking change
// Breaking changes (major version bumps) always require manual confirmation
const isBreakingChange = nextCommitObject.recommendedNextVersionLevel === 'BREAKING CHANGE';
const canAutoAccept = (argvArg.y || argvArg.yes) && !isBreakingChange;
if (canAutoAccept) {
// Auto-mode: create AnswerBucket programmatically
logger.log('info', '✓ Auto-accepting AI recommendations (--yes flag)');
@@ -53,6 +57,10 @@ export const run = async (argvArg: any) => {
value: !!(argvArg.p || argvArg.push), // Only push if -p flag also provided
});
} else {
// Warn if --yes was provided but we're requiring confirmation due to breaking change
if (isBreakingChange && (argvArg.y || argvArg.yes)) {
logger.log('warn', '⚠️ BREAKING CHANGE detected - manual confirmation required');
}
// Interactive mode: prompt user for input
const commitInteract = new plugins.smartinteract.SmartInteract();
commitInteract.addQuestions([