Skip to content

feat: warn on hidden, deprecated aliases#1555

Merged
jfeingold35 merged 1 commit intooclif:mainfrom
rexxars:fix/warn-on-hidden-deprecated
Mar 12, 2026
Merged

feat: warn on hidden, deprecated aliases#1555
jfeingold35 merged 1 commit intooclif:mainfrom
rexxars:fix/warn-on-hidden-deprecated

Conversation

@rexxars
Copy link
Copy Markdown
Contributor

@rexxars rexxars commented Mar 12, 2026

In my opinion, deprecateAliases should also check hiddenAliases

When deprecating a command alias, the natural combination is:

  1. Hide it from help text (so new users don't discover it)
  2. Warn existing users that it's deprecated (so they migrate)

Currently, deprecateAliases only checks aliases:

// command.js – warnIfCommandDeprecated()
if (this.ctor.deprecateAliases && this.ctor.aliases.includes(id)) {

This means there's no way to get both behaviors. You either:

  • Put the alias in aliases + deprecateAliases: true → warns, but still shows in help
  • Put the alias in hiddenAliases + deprecateAliases: true → hidden, but no warning
  • Put it in both aliases and hiddenAliasesaliases wins, still shows in help

Proposed fix: warnIfCommandDeprecated should check both arrays.

This would let you do the standard deprecation flow: move an alias from aliases to hiddenAliases, set deprecateAliases: true, and get the expected behavior - hidden from help, warns on use.

@jfeingold35
Copy link
Copy Markdown
Contributor

@rexxars , thanks for creating this. I'll get it reviewed, QA'd, and let you know if anything needs to change or if it's good to merge.

@jfeingold35
Copy link
Copy Markdown
Contributor

@rexxars , I've QA'd this and all the tests are green, so I'm going to go ahead and merge this. Thank you so much!

@jfeingold35 jfeingold35 merged commit ee6f7e3 into oclif:main Mar 12, 2026
88 checks passed
@rexxars rexxars deleted the fix/warn-on-hidden-deprecated branch March 13, 2026 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants