Skip to content

Commit f3bda78

Browse files
committed
refactor(cli): standardize dry-run flags to --dry-run
deploy uses --plan while create and remove use --dry-run. Same concept, different names. Now --dry-run is the primary flag on deploy. --plan is preserved as an alias for backward compatibility. Output message updated from 'Plan complete' to 'Dry run complete'. Constraint: Must not break existing scripts using --plan on deploy Rejected: Use --plan everywhere | --dry-run is the standard convention Confidence: high Scope-risk: narrow
1 parent a5561d5 commit f3bda78

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/cli/commands/deploy/command.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ async function handleDeployCLI(options: DeployOptions): Promise<void> {
9090
if (options.diff) {
9191
console.log(`\n✓ Diff complete for '${result.targetName}' (stack: ${result.stackName})`);
9292
} else if (options.plan) {
93-
console.log(`\n✓ Plan complete for '${result.targetName}' (stack: ${result.stackName})`);
93+
console.log(`\n✓ Dry run complete for '${result.targetName}' (stack: ${result.stackName})`);
9494
console.log('\nRun `agentcore deploy` to deploy.');
9595
} else {
9696
console.log(`\n✓ Deployed to '${result.targetName}' (stack: ${result.stackName})`);
@@ -136,23 +136,27 @@ export const registerDeploy = (program: Command) => {
136136
.option('-y, --yes', 'Auto-confirm prompts, read credentials from env [non-interactive]')
137137
.option('-v, --verbose', 'Show resource-level deployment events [non-interactive]')
138138
.option('--json', 'Output as JSON [non-interactive]')
139-
.option('--plan', 'Preview deployment without deploying (dry-run) [non-interactive]')
139+
.option('--dry-run', 'Preview deployment without deploying [non-interactive]')
140+
.option('--plan', 'Preview deployment without deploying (alias for --dry-run) [non-interactive]')
140141
.option('--diff', 'Show CDK diff without deploying [non-interactive]')
141142
.action(
142143
async (cliOptions: {
143144
target?: string;
144145
yes?: boolean;
145146
verbose?: boolean;
146147
json?: boolean;
148+
dryRun?: boolean;
147149
plan?: boolean;
148150
diff?: boolean;
149151
}) => {
150152
try {
151153
requireProject();
152-
if (cliOptions.json || cliOptions.target || cliOptions.plan || cliOptions.yes || cliOptions.verbose) {
154+
const isDryRun = cliOptions.dryRun ?? cliOptions.plan;
155+
if (cliOptions.json || cliOptions.target || isDryRun || cliOptions.yes || cliOptions.verbose) {
153156
// CLI mode - any flag triggers non-interactive mode
154157
const options = {
155158
...cliOptions,
159+
plan: isDryRun,
156160
target: cliOptions.target ?? 'default',
157161
progress: !cliOptions.json,
158162
};

0 commit comments

Comments
 (0)