Skip to content

[CLI] Fix parent aliases leaking into subcommand headers in CLI reference#4253

Merged
Wauplin merged 2 commits into
mainfrom
fix/cli-reference-alias-headers
May 22, 2026
Merged

[CLI] Fix parent aliases leaking into subcommand headers in CLI reference#4253
Wauplin merged 2 commits into
mainfrom
fix/cli-reference-alias-headers

Conversation

@Wauplin

@Wauplin Wauplin commented May 22, 2026

Copy link
Copy Markdown
Collaborator

Fixes titles in current docs:

image
  • Parent group aliases (e.g. repos | repo, extensions | ext) were leaking into subcommand section headers in the generated CLI reference. For instance #### hf repos | repo branch create instead of #### hf repos branch create.
  • Fixed _transform_section in generate_cli_reference.py to strip aliases from all path segments, and only annotate the description when the leaf command itself has aliases (e.g. list | ls).

Before: ### hf repos | repo branch create, ### hf extensions | ext install
After: ### hf repos branch create, ### hf extensions install

🤖 Generated with Claude Code


Note

Low Risk
Low risk documentation-generation change: adjusts regex parsing for CLI reference headers and updates the generated cli.md plus a unit test, with no runtime CLI behavior impact.

Overview
Fixes CLI reference generation so parent group aliases (e.g. repos | repo, extensions | ext) no longer leak into subcommand section headers.

Updates _normalize_command_aliases in utils/generate_cli_reference.py to strip aliases from every command-path segment and only append alias info for the leaf command, then regenerates docs/source/en/package_reference/cli.md accordingly and updates the related test expectation.

Reviewed by Cursor Bugbot for commit 1f5f46a. Bugbot is set up for automated code reviews on this repo. Configure here.

…ence

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bot-ci-comment

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@Wauplin Wauplin requested a review from hanouticelina May 22, 2026 15:27

@hanouticelina hanouticelina left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Wauplin Wauplin merged commit 2d1fb8d into main May 22, 2026
22 checks passed
@Wauplin Wauplin deleted the fix/cli-reference-alias-headers branch May 22, 2026 16:00
@huggingface-hub-bot

Copy link
Copy Markdown
Contributor

This PR has been shipped as part of the v1.17.0 release.

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.

2 participants