Skip to content

Generalize --force deprecation warning into BaseCommand#7046

Draft
alfonso-noriega wants to merge 2 commits intomainfrom
03-12-generalize-force-deprecation-into-base-command
Draft

Generalize --force deprecation warning into BaseCommand#7046
alfonso-noriega wants to merge 2 commits intomainfrom
03-12-generalize-force-deprecation-into-base-command

Conversation

@alfonso-noriega
Copy link
Contributor

WHY are these changes introduced?

Fixes #0000

WHAT is this pull request doing?

How to test your changes?

Post-release steps

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

Copy link
Contributor Author

alfonso-noriega commented Mar 19, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 19, 2026

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 82.22% 14978/18217
🟡 Branches 74.69% 7417/9930
🟢 Functions 81.23% 3773/4645
🟢 Lines 82.63% 14165/17143

Test suite run success

3920 tests passing in 1506 suites.

Report generated by 🧪jest coverage report action from 64fd4d9

alfonso-noriega and others added 2 commits March 20, 2026 10:06
Add a `deprecated()` helper to BaseCommand that attaches a deprecation warning
to any flag definition, and a private `showDeprecatedFlagWarnings()` method that
fires the warning automatically during `parse()` when the flag is used. Remove
the manual `if (flags.force) { renderWarning(...) }` blocks from deploy.ts and
release.ts in favour of wrapping the flag declarations with `deprecated()`.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move showDeprecatedFlagWarnings to after all protected methods,
alongside the other private methods.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@alfonso-noriega alfonso-noriega force-pushed the 03-12-deprecate_force_flag_on_deploy_and_release branch from b8bd1d7 to 8889ed3 Compare March 20, 2026 09:06
@alfonso-noriega alfonso-noriega force-pushed the 03-12-generalize-force-deprecation-into-base-command branch from 805fe37 to 64fd4d9 Compare March 20, 2026 09:06
@github-actions
Copy link
Contributor

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/public/node/base-command.d.ts
@@ -1,7 +1,9 @@
+import { RenderAlertOptions } from './ui.js';
 import { Command } from '@oclif/core';
 import { OutputFlags, Input, ParserOutput, FlagInput, OutputArgs } from '@oclif/core/parser';
 export type ArgOutput = OutputArgs<any>;
 export type FlagOutput = OutputFlags<any>;
+export declare function deprecated<T>(flag: T, warning: RenderAlertOptions): T;
 declare abstract class BaseCommand extends Command {
     static baseFlags: FlagInput<{}>;
     static descriptionWithoutMarkdown(): string | undefined;
@@ -21,6 +23,7 @@ declare abstract class BaseCommand extends Command {
     }>;
     protected environmentsFilename(): string | undefined;
     protected failMissingNonTTYFlags(flags: FlagOutput, requiredFlags: string[]): void;
+    private showDeprecatedFlagWarnings;
     private resultWithEnvironment;
     /**
      * Tries to load an environment to forward to the command. If no environment

Base automatically changed from 03-12-deprecate_force_flag_on_deploy_and_release to main March 20, 2026 09:55
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