Skip to content

[CLI] Easter egg: city skyline in hf repos ls#4287

Merged
Wauplin merged 16 commits into
mainfrom
city-easter-egg
May 28, 2026
Merged

[CLI] Easter egg: city skyline in hf repos ls#4287
Wauplin merged 16 commits into
mainfrom
city-easter-egg

Conversation

@Wauplin

@Wauplin Wauplin commented May 28, 2026

Copy link
Copy Markdown
Collaborator

Running hf repos ls --explore now renders an animated city skyline in the terminal before showing results.

Demo

Screencast.from.28-05-2026.11.32.19.webm

Note

Low Risk
Self-contained CLI easter egg with no changes to auth, uploads, or core Hub APIs; only affects optional interactive listing.

Overview
Adds an optional --explore flag to hf repos ls that launches an interactive terminal “city” instead of printing the usual table.

When --explore is set and output is human-readable, the CLI runs a new _city_game module: repos become isometric blocks (height/color by storage and type), with WASD navigation, storage summary panels, and raw TTY handling (Unix, minimum terminal size). Non-interactive or non-human output modes get a clear error instead of the game.

CLI reference and command examples document the new flag.

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

Wauplin and others added 3 commits May 27, 2026 17:40
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

Comment thread src/huggingface_hub/cli/_city_view.py Outdated
Base automatically changed from cli-repos-ls to main May 28, 2026 14:09
Comment thread src/huggingface_hub/cli/_city_game.py Outdated

_MOVE_FRAMES = 8
_MOVE_DELAY = 0.03
_CURSOR_PAD = _CURSOR_H + 16

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Odd cursor padding breaks even buffer height invariant

Low Severity

_CURSOR_PAD is 21 (odd: _CURSOR_H(5) + 16), and when added to buf_h at line 114, it breaks the even-height invariant that prepare_city_data explicitly enforces (if buf_h % 2: buf_h += 1). The _pixels_to_lines function processes pixel rows in pairs for half-block character rendering. An odd buffer height causes the last content row to be unpaired and shifts all row pairings by one pixel, resulting in subtly different rendering compared to the intended alignment.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 08c7542. Configure here.

@Wauplin

Wauplin commented May 28, 2026

Copy link
Copy Markdown
Collaborator Author

PR is now ready for review. I don't think it's useful to review anything in depth in the _city_game.py module as it's all self-contained and non-important stuff. The only semi-public facing method is run_city_game which can maybe be reviewed but all the rest is really just to try out in your own terminal.

Let's remember it's just an easter egg so let's not over-optimize it^^

@Wauplin Wauplin marked this pull request as ready for review May 28, 2026 15:52

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 using default effort and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

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 e5d4a1b. Configure here.

while city_lines and not _strip_ansi(city_lines[0]).strip():
city_lines.pop(0)
while city_lines and not _strip_ansi(city_lines[-1]).strip():
city_lines.pop()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Empty-line stripping causes city to shift during animations

Low Severity

The _present function strips empty lines from the top of city_lines on every frame. During the intro drop animation (and when moving between tiles of different heights), the cursor is drawn at varying vertical positions in the pixel buffer. Since the topmost non-empty content changes frame-to-frame, a varying number of lines get stripped, causing the city tiles to visually jump up/down within the terminal. The worst case is the intro animation where the city can shift by ~8 terminal lines over 240ms as the cursor descends into view.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e5d4a1b. Configure here.

@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.

very very cool!

@Wauplin Wauplin merged commit e064d1c into main May 28, 2026
24 of 26 checks passed
@Wauplin Wauplin deleted the city-easter-egg branch May 28, 2026 18:57
@huggingface-hub-bot

Copy link
Copy Markdown
Contributor

This PR has been shipped as part of the v1.18.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