Repository navigation
feat: LinkedTextBlock shape with clickable rows (OSC 8) + hn_top fetcher - #148
Conversation
`LinkedTextBlock` is a sibling of `TextBlock` whose rows carry an optional URL. The new `list_links` renderer wraps each linked row in OSC 8 escape sequences so modern terminals surface them as clickable hyperlinks; rows without a URL fall through to plain text. Renderers that don't understand links can ignore the field, keeping `TextBlock` consumers untouched. Implementation note: the OSC 8 sequence is collapsed into the first cell's symbol with `skip = true` on the trailing cells to dodge ratatui's diff-side width calculation, which otherwise counts printable bytes inside the escape sequence as visible columns and silently swallows the cell after the link. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Hacker News stories — top / new / best / ask / show / job — via the public read-only Firebase API (`hacker-news.firebaseio.com`, fixed host so safety class stays Safe). Branches on shape: `LinkedTextBlock` (default) populates each row's URL with the story link, falling back to the HN comment page when absent; `TextBlock` and `Entries` keep working for non-linked renderers. Story metadata (`Npt Mc`) is prepended to each row. Catalog: ticks the `hn_top` checkbox in #67. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Fetchers whose rows have a canonical "open this" URL now branch on `LinkedTextBlock` shape and populate each row with the matching HTML link: - `items.rs` (shared by `github_my_prs`, `github_review_requests`, `github_assigned_issues`, `github_repo_prs`, `github_repo_issues`, `github_good_first_issues`) — uses `IssueItem.html_url`. - `github_recent_releases` — uses release `html_url`. - `github_notifications` — converts `subject.url` (`api.github.com/repos/...`) to the browser HTML URL (`github.com/...`); rows without a parseable URL render unlinked. - `github_contributors_monthly` — links to each contributor's `https://github.com/{login}` profile. Existing shapes (`TextBlock` / `Entries` / `Timeline` / `Bars`) are unchanged, so renderers that don't request `LinkedTextBlock` see no behaviour difference. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
`home_github` (my_prs / review_queue / notifications) and `project_github` (repo_prs / repo_issues / releases) now use `render = "list_links"` so the default presets ship with clickable rows out of the box. Bullet glyphs and the timeline date label drop in exchange — clickability is the bigger win for these queues. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThe PR introduces a new Changes
Sequence DiagramsequenceDiagram
participant Fetcher as GitHub/HN Fetcher
participant PayloadBuilder as Payload Constructor
participant RenderPipeline as Render Pipeline
participant ListLinksRenderer as ListLinksRenderer
participant Terminal as Terminal Buffer
Fetcher->>PayloadBuilder: Construct LinkedTextBlock<br/>(LinkedLine items with<br/>text + optional url)
PayloadBuilder->>RenderPipeline: Return Body::LinkedTextBlock
RenderPipeline->>RenderPipeline: shape_of() → LinkedTextBlock<br/>default_renderer() → ListLinksRenderer
RenderPipeline->>ListLinksRenderer: Render LinkedTextBlockData
ListLinksRenderer->>Terminal: For each row without url:<br/>Write text to buffer
ListLinksRenderer->>Terminal: For each row with url:<br/>Wrap in OSC 8 open<br/>+ visible text<br/>+ OSC 8 close
Terminal-->>ListLinksRenderer: Terminal display<br/>with clickable links
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #148 +/- ##
==========================================
- Coverage 79.30% 78.72% -0.58%
==========================================
Files 98 105 +7
Lines 18479 19775 +1296
==========================================
+ Hits 14654 15568 +914
- Misses 3825 4207 +382
🚀 New features to boost your workflow:
|
Spell out the family prefix to match `github_*` / `gitlab_*` / `clock_*` — two-letter abbreviation was an outlier. No behaviour change; only the fetcher name, struct, module path, and doc references move. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…client Promotes `hackernews_top.rs` into `src/fetcher/hackernews/` so siblings (`hackernews_user`, `hackernews_user_submissions`, `hackernews_user_comments`) can share the HTTP client setup, base URL constants, and the OSC 8 / HN user-page link helpers without each file open-coding `OnceLock<Client>` and the Firebase host. Mirrors the layout used by the `github_*` family. No behaviour change: only `hackernews_top` ships in this commit; the sibling fetchers land in the next commit. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Three account-scoped fetchers powered by HN's `/user/{login}.json` and
`/item/{id}.json` Firebase endpoints (Safety::Safe, fixed host).
- `hackernews_user` — single-read profile rollup. Multi-shape:
- `Text` (`@login · Npt karma`) for hero / subtitle bands.
- `Entries` (login / karma / created / submissions count, plus `about`
when present) for grid_table.
- `TextBlock` for sidebar bio blocks.
- `LinkedTextBlock` for a one-row clickable link to the HN user page.
- `hackernews_user_submissions` — fans out the `submitted` array, filters
to story-shaped types (`story` / `show_hn` / `ask_hn` / `job`), and
emits `LinkedTextBlock` rows linked to the article URL or HN comment
page. `TextBlock` / `Entries` shapes also supported.
- `hackernews_user_comments` — same fan-out filtered to `type=comment`,
rendering each comment as a tag-stripped, truncated snippet linked to
its HN comment page.
The `submitted` walk caps at 80 candidates per call so a prolific account
with mostly-comments doesn't fan out hundreds of item requests just to
surface a handful of stories.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Adds the gaps the previous commits left thin: - payload: round-trip + serialization-tag tests for `LinkedTextBlock`, plus the `url`-omitted-when-None case (mirrors the existing TextBlock / Entries / Timeline coverage). - hackernews_top: empty `LinkedTextBlock` body, missing-id link drop, zero defaults for score / comments, every `kind` variant parses, and clamp semantics for `count`. - hackernews_user: TextBlock branch with / without `about`, empty-string `about` is treated as missing, submission count uses `.len()` not the full array, minimal-payload deserialization, `decode_entities` over the full canonical set, and an invalid-timestamp `iso_date` fallback. - hackernews_user_submissions: TextBlock + Entries branches, explicit story URL preferred over fallback, missing title placeholder, empty body, `UserStub` deserialization, and `deny_unknown_fields` enforced. - hackernews_user_comments: TextBlock branch, missing text / id edge cases, nested-tag stripping, short-input truncate, empty body, unaccepted-shape fallthrough. - list_links: multiple linked rows each get an independent OSC 8 wrap, mixed linked/unlinked rows only wrap the linked ones, area-height cap, and a CJK case that documents the wide-grapheme trailing-cell behavior. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Summary
LinkedTextBlockshape — aTextBlocksibling whose rows carry an optional URL — and a newlist_linksrenderer that wraps linked rows in OSC 8 escape sequences so modern terminals surface them as clickable hyperlinks. Rows without a URL fall through to plain text.hn_topfetcher (Hacker News top / new / best / ask / show / job stories) over the public read-only Firebase API; rows link to the story URL or the HN comment page.github_*feed fetchers (my_prs,review_requests,assigned_issues,repo_prs,repo_issues,good_first_issues,recent_releases,notifications,contributors_monthly, plus the shareditems.rspath) to emitLinkedTextBlockwhen that shape is requested. Existing shapes (TextBlock/Entries/Timeline/Bars) keep working unchanged.home_github(my_prs / review_queue / notifications) andproject_github(repo_prs / repo_issues / releases) presets torender = "list_links"so the default templates ship with clickable rows.Implementation note worth flagging for review: the OSC 8 sequence is collapsed into the first cell's symbol, with
skip = trueon the trailing cells of the linked region. ratatui'sBuffer::diffcomputes per-cell width viaunicode_width::UnicodeWidthStr::width(), which counts every printable byte inside the escape sequence as a visible column — without theskipworkaround the cells immediately after the link silently drop. Seesrc/render/list_links.rsmodule doc for the longer write-up.Catalog: ticks the
hn_topcheckbox in #67. The 10github_*fetchers were already shipped — this PR extends each with one more shape, no checkbox flip needed.Test plan
cargo fmt --all -- --checkcargo clippy --all-targets -- -D warningscargo test(632 passed)cargo run --bin splashboardwith a.splashboard/dashboard.tomlexercisinghn_top,github_my_prs,github_review_requests,github_notifications,github_recent_releases— confirmed clickable in the user's terminal.🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
New Features
Improvements