Skip to content

Commit a5561d5

Browse files
committed
refactor(cli): standardize confirmation skip flags to -y/--yes
deploy uses -y, --yes while remove uses --force. These mean the same thing (skip interactive confirmation) but used different names. Now -y/--yes is the primary flag everywhere. --force is preserved as an alias on remove commands for backward compatibility. Constraint: Must not break existing scripts using --force on remove Rejected: Use --force everywhere | --yes is the conventional flag name for confirmation skip Confidence: high Scope-risk: narrow
1 parent b71f385 commit a5561d5

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

src/cli/commands/remove/command.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,17 @@ export const registerRemove = (program: Command): Command => {
6262
removeCommand
6363
.command('all')
6464
.description('Reset all agentcore schemas to empty state')
65-
.option('--force', 'Skip confirmation prompts [non-interactive]')
65+
.option('-y, --yes', 'Skip confirmation prompts [non-interactive]')
66+
.option('--force', 'Skip confirmation prompts (alias for --yes) [non-interactive]')
6667
.option('--dry-run', 'Show what would be reset without actually resetting [non-interactive]')
6768
.option('--json', 'Output as JSON [non-interactive]')
68-
.action(async (cliOptions: { force?: boolean; dryRun?: boolean; json?: boolean }) => {
69+
.action(async (cliOptions: { yes?: boolean; force?: boolean; dryRun?: boolean; json?: boolean }) => {
6970
try {
71+
const skipConfirm = cliOptions.yes ?? cliOptions.force;
7072
// Any flag triggers non-interactive CLI mode
71-
if (cliOptions.force || cliOptions.dryRun || cliOptions.json) {
73+
if (skipConfirm || cliOptions.dryRun || cliOptions.json) {
7274
await handleRemoveAllCLI({
73-
force: cliOptions.force,
75+
force: skipConfirm,
7476
dryRun: cliOptions.dryRun,
7577
json: cliOptions.json,
7678
});

src/cli/primitives/BasePrimitive.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,19 @@ export abstract class BasePrimitive<
103103
.command(this.kind)
104104
.description(`Remove ${this.article} ${this.label.toLowerCase()} from the project`)
105105
.option('--name <name>', 'Name of resource to remove [non-interactive]')
106-
.option('--force', 'Skip confirmation prompt [non-interactive]')
106+
.option('-y, --yes', 'Skip confirmation prompt [non-interactive]')
107+
.option('--force', 'Skip confirmation prompt (alias for --yes) [non-interactive]')
107108
.option('--json', 'Output as JSON [non-interactive]')
108-
.action(async (cliOptions: { name?: string; force?: boolean; json?: boolean }) => {
109+
.action(async (cliOptions: { name?: string; yes?: boolean; force?: boolean; json?: boolean }) => {
109110
try {
110111
if (!findConfigRoot()) {
111112
console.error('No agentcore project found. Run `agentcore create` first.');
112113
process.exit(1);
113114
}
114115

116+
const skipConfirm = cliOptions.yes ?? cliOptions.force;
115117
// Any flag triggers non-interactive CLI mode
116-
if (cliOptions.name || cliOptions.force || cliOptions.json) {
118+
if (cliOptions.name || skipConfirm || cliOptions.json) {
117119
if (!cliOptions.name) {
118120
console.log(JSON.stringify({ success: false, error: '--name is required' }));
119121
process.exit(1);

0 commit comments

Comments
 (0)