feat: taibai trending command (Milestone 6a) #2

Closed
opened 2026-05-24 02:29:00 +00:00 by coding-agent-marvin8 · 1 comment
coding-agent-marvin8 commented 2026-05-24 02:29:00 +00:00 (Migrated from codeberg.org)

Add taibai trending [statuses|accounts|tags|links] [--limit N] with instance-type guard (Mastodon-only trending APIs).

Relevant longwei methods (v1.5.0):

  • get_trending_statuses(limit, offset) -> list[Status]
  • get_trending_accounts(limit, offset) -> list[Account]
  • get_trending_hashtags(limit, offset) -> list[Tag]
  • get_trending_links(limit, offset) -> list[Card]
Add `taibai trending [statuses|accounts|tags|links] [--limit N]` with instance-type guard (Mastodon-only trending APIs). Relevant longwei methods (v1.5.0): - `get_trending_statuses(limit, offset) -> list[Status]` - `get_trending_accounts(limit, offset) -> list[Account]` - `get_trending_hashtags(limit, offset) -> list[Tag]` - `get_trending_links(limit, offset) -> list[Card]`
coding-agent-marvin8 commented 2026-05-24 02:29:56 +00:00 (Migrated from codeberg.org)

Exploration findings:

  • longwei 1.5.0 adds get_trending_hashtags(limit, offset) -> list[Tag] (hits GET /api/v1/trends/tags); Tag model has name and url fields.
  • Instance type detection via ap.instance_type after APClient.create() — constants INSTANCE_TYPE_MASTODON, INSTANCE_TYPE_PLEROMA, INSTANCE_TYPE_SNAC in longwei.constants. Trending is Mastodon-specific; guard all variants.
  • Rendering: statuses → existing _render_status_table(); accounts/tags/links → new custom Rich tables.

Plan of attack:

  1. Bump pyproject.toml longwei constraint ~=1.4.3~=1.5.0, update lockfile.
  2. Write failing tests (tests/test_trending.py) — CLI layer (mock run_async) + async layer (httpx_mock).
  3. Implement src/taibai/commands/trending.py: single-function command dispatching on Literal["statuses","accounts","tags","links"], default "statuses". Guard: die() if ap.instance_type != INSTANCE_TYPE_MASTODON.
  4. Register in src/taibai/cli.py as app.command(name="trending")(trending_command).
  5. Add docs/trending.md + mkdocs.yml nav entry.
**Exploration findings:** - longwei 1.5.0 adds `get_trending_hashtags(limit, offset) -> list[Tag]` (hits `GET /api/v1/trends/tags`); `Tag` model has `name` and `url` fields. - Instance type detection via `ap.instance_type` after `APClient.create()` — constants `INSTANCE_TYPE_MASTODON`, `INSTANCE_TYPE_PLEROMA`, `INSTANCE_TYPE_SNAC` in `longwei.constants`. Trending is Mastodon-specific; guard all variants. - Rendering: statuses → existing `_render_status_table()`; accounts/tags/links → new custom Rich tables. **Plan of attack:** 1. Bump `pyproject.toml` longwei constraint `~=1.4.3` → `~=1.5.0`, update lockfile. 2. Write failing tests (`tests/test_trending.py`) — CLI layer (mock `run_async`) + async layer (httpx_mock). 3. Implement `src/taibai/commands/trending.py`: single-function command dispatching on `Literal["statuses","accounts","tags","links"]`, default `"statuses"`. Guard: `die()` if `ap.instance_type != INSTANCE_TYPE_MASTODON`. 4. Register in `src/taibai/cli.py` as `app.command(name="trending")(trending_command)`. 5. Add `docs/trending.md` + `mkdocs.yml` nav entry.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
marvin8/taibai#2
No description provided.