Skip to content

[CLI] Migrate collections, discussions, extensions, endpoints and webhooks to `out singleton#4057

Draft
hanouticelina wants to merge 7 commits intomainfrom
cli-migrate-commands-part2
Draft

[CLI] Migrate collections, discussions, extensions, endpoints and webhooks to `out singleton#4057
hanouticelina wants to merge 7 commits intomainfrom
cli-migrate-commands-part2

Conversation

@hanouticelina
Copy link
Copy Markdown
Contributor

@hanouticelina hanouticelina commented Apr 6, 2026

Part of #3979 (Phase 2)

This PR migrates list and info commands in collections , discussions, extensions, endpoints and webhooks to use the out singleton.

This PR introduces some notable breaking changes,in addition to those that affects all migrated commands, e.g. -q/--quiet replaced by --format quiet:

hf endpoints ls: (same issue as for hf auth whoami)

  • JSON: flat fields only (name, model, status, task, framework, instance, vendor, region), it was full endpoint.raw with nested objects when passing --format json.

hf discussions info:

  • Rich text view replaced by JSON output
  • --comments, --diff, --no-color flags removed

Note

Medium Risk
Changes CLI output formatting and flags across multiple commands (notably replacing --quiet/-q with --format quiet and altering hf discussions info output/flags), which can break scripts relying on previous text output or options.

Overview
Migrates collections, discussions, extensions, endpoints, and webhooks commands to use the out singleton (--format [agent|auto|human|json|quiet]) instead of ad-hoc print/print_list_output + --quiet/-q.

Updates output behavior to be mode-aware (human tables vs agent TSV/JSON), adds per-invocation reset of output state (HFCliApp.__call__ / hf callback), and adjusts some commands’ structured output (e.g., hf discussions info now emits JSON via out.dict and drops --comments/--diff/--no-color; hf endpoints ls/hf webhooks ls preserve nested fields in json/agent but flatten for human display). Docs and tests are updated to match the new flags and output semantics, including safeguards that quiet mode doesn’t leak between CLI invocations.

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

@hanouticelina hanouticelina requested a review from Wauplin April 6, 2026 16:10
@bot-ci-comment
Copy link
Copy Markdown

bot-ci-comment bot commented Apr 6, 2026

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.

@hanouticelina hanouticelina changed the title [CLI] Migrate collections , discussions, extensions, endpoints and webhooks to `out singleton [CLI] Migrate collections, discussions, extensions, endpoints and webhooks to `out singleton Apr 7, 2026
Comment on lines -251 to -271
comments: Annotated[
bool,
typer.Option(
"--comments",
help="Show all comments.",
),
] = False,
diff: Annotated[
bool,
typer.Option(
"--diff",
help="Show the diff (for pull requests).",
),
] = False,
no_color: Annotated[
bool,
typer.Option(
"--no-color",
help="Disable colored output.",
),
] = False,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

breaking change here: the rich text view defined in _print_discussion_info is replaced by out.dict(details), consistent with all other info commands (models info, datasets info etc). The --comments, --diff, and --no-color flags are removed. Comments and diff are always included in the JSON output. I think it's fine no? a user can just call hf discussions diff to view diffs separately

@hanouticelina hanouticelina marked this pull request as ready for review April 7, 2026 14:10
Co-authored-by: célina <hanouticelina@users.noreply.github.com>
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 5566b74. Configure here.

@hanouticelina hanouticelina force-pushed the cli-migrate-commands-part2 branch from 5566b74 to f6bf21c Compare April 7, 2026 17:27
@hanouticelina hanouticelina marked this pull request as draft April 7, 2026 18:21
@hanouticelina hanouticelina force-pushed the cli-migrate-commands-part2 branch from a588ff0 to f6bf21c Compare April 7, 2026 18:23
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