diff --git a/scripts/modules/commands.js b/scripts/modules/commands.js index caecaacb..e93be1d2 100644 --- a/scripts/modules/commands.js +++ b/scripts/modules/commands.js @@ -65,6 +65,7 @@ import { displayApiKeyStatus, displayAiUsageSummary } from './ui.js'; +import { confirmRulesRemove } from '../../src/ui/confirm.js'; import { initializeProject } from '../init.js'; import { @@ -2438,7 +2439,7 @@ Examples: let confirmed = true; if (!options.force) { const ui = await import('./ui.js'); - confirmed = await ui.confirmRulesRemove(expandedBrands); + confirmed = await confirmRulesRemove(expandedBrands); } if (!confirmed) { console.log(chalk.yellow('Aborted: No rules were removed.')); diff --git a/scripts/modules/ui.js b/scripts/modules/ui.js index 45f07b0d..0432a6a0 100644 --- a/scripts/modules/ui.js +++ b/scripts/modules/ui.js @@ -1769,35 +1769,7 @@ IMPORTANT: Make sure to include an analysis for EVERY task listed above, with th `; } -/** - * Confirm removing brand rules (destructive operation) - * @param {string[]} brands - Array of brand names to remove - * @returns {Promise} - Promise resolving to true if user confirms, false otherwise - */ -async function confirmRulesRemove(brands) { - const brandList = brands - .map((b) => b.charAt(0).toUpperCase() + b.slice(1)) - .join(', '); - console.log( - boxen( - chalk.yellow( - `WARNING: This will permanently delete all rules and configuration for: ${brandList}. -This will remove the entire .[brand] directory for each selected brand.\n\nAre you sure you want to proceed?` - ), - { padding: 1, borderColor: 'yellow', borderStyle: 'round' } - ) - ); - const inquirer = await import('inquirer'); - const { confirm } = await inquirer.default.prompt([ - { - type: 'confirm', - name: 'confirm', - message: 'Type y to confirm, or n to abort:', - default: false - } - ]); - return confirm; -} + /** * Confirm overwriting existing tasks.json file @@ -2111,6 +2083,5 @@ export { displayApiKeyStatus, displayModelConfiguration, displayAvailableModels, - displayAiUsageSummary, - confirmRulesRemove + displayAiUsageSummary }; diff --git a/src/ui/confirm.js b/src/ui/confirm.js new file mode 100644 index 00000000..c77fb351 --- /dev/null +++ b/src/ui/confirm.js @@ -0,0 +1,34 @@ +import chalk from 'chalk'; +import boxen from 'boxen'; + +/** + * Confirm removing brand rules (destructive operation) + * @param {string[]} brands - Array of brand names to remove + * @returns {Promise} - Promise resolving to true if user confirms, false otherwise + */ +async function confirmRulesRemove(brands) { + const brandList = brands + .map((b) => b.charAt(0).toUpperCase() + b.slice(1)) + .join(', '); + console.log( + boxen( + chalk.yellow( + `WARNING: This will permanently delete all rules and configuration for: ${brandList}. +This will remove the entire .[brand] directory for each selected brand.\n\nAre you sure you want to proceed?` + ), + { padding: 1, borderColor: 'yellow', borderStyle: 'round' } + ) + ); + const inquirer = await import('inquirer'); + const { confirm } = await inquirer.default.prompt([ + { + type: 'confirm', + name: 'confirm', + message: 'Type y to confirm, or n to abort:', + default: false + } + ]); + return confirm; +} + +export { confirmRulesRemove }; \ No newline at end of file