Skip to content

feat: align index route with hosted prologue/chapters + PR description#65

Draft
dastratakos wants to merge 6 commits into
mainfrom
dastratakos/kelowna-v1
Draft

feat: align index route with hosted prologue/chapters + PR description#65
dastratakos wants to merge 6 commits into
mainfrom
dastratakos/kelowna-v1

Conversation

@dastratakos
Copy link
Copy Markdown
Contributor

@dastratakos dastratakos commented Jun 2, 2026

Summary

Brings the stage-cli index route in line with the hosted Stage app: a tabbed Prologue/Description overview sidebar alongside a card-style chapters list. When a PR is detected for the branch, its description is now surfaced as markdown in the same comment-style card the hosted app uses.

Changes

  • Add body to the PR wire type and source it from gh pr view
  • New PullRequestBodyCard renders the PR description as a GitHub-style comment card
  • New OverviewSidebar with Prologue/Description tabs (each shown only when its content exists); extract a shared OverviewColumnHeader
  • Rewrite the chapters list to hosted's bordered card rows — per-row viewed toggle, line/file counts, and a "Start/Continue reviewing" CTA on the next unviewed chapter
  • Drop the CLI-only progress bar and per-chapter collapsible file lists (not present in the hosted index)

Testing

pnpm typecheck, pnpm lint, pnpm test (299 passing), and pnpm build all pass.


Open in Stage

Summary by cubic

Aligns the Stage CLI index with the hosted app: adds a tabbed Prologue/Description sidebar, a card-style chapters list, and shows the branch’s PR description in a GitHub-style comment card. The index is now locked to the viewport so the PR header and tabs stay fixed while the overview and chapters columns scroll independently.

  • New Features

    • Added body to the PR API/type from gh pr view; PullRequestBodyCard renders it.
    • New OverviewSidebar with Prologue/Description tabs and a shared sticky OverviewColumnHeader.
    • Chapters rebuilt as bordered rows with viewed toggle, line/file counts, and a “Start/Continue reviewing” CTA (replaces the progress bar and file collapsibles).
    • Copy buttons for Prologue and Chapters export markdown via formatPrologueAsMarkdown and formatAllChaptersAsMarkdown.
    • PR descriptions can include sanitized HTML (e.g., <picture> badges) via rehype-raw + rehype-sanitize.
    • Index uses contained scroll: PR header and tab nav are fixed; overview and chapters panels scroll independently. Files and chapter detail keep page scroll.
  • Bug Fixes

    • Web: keep the active tab when prologue/description data arrives (no silent switches).
    • Web: match hosted — review focus shows plain muted filenames (no scroll-to links).
    • CLI: coerce a null PR body to an empty string to preserve PR context.

Written for commit 9578a7d. Summary will update on new commits.

Review in cubic

Match the hosted Stage index layout: a tabbed Prologue/Description overview
sidebar and a card-style chapters list, and surface the detected PR's
description as markdown.

- Add `body` to the PR wire type and source it from `gh pr view`
- New PullRequestBodyCard renders the PR description as a comment-style card
- New OverviewSidebar exposes Prologue/Description tabs (each shown only when
  its content exists); extract shared OverviewColumnHeader
- Rewrite the chapters list to hosted's bordered card rows with per-row viewed
  toggle, line/file counts, and a "Start/Continue reviewing" CTA
@stage-review
Copy link
Copy Markdown

stage-review Bot commented Jun 2, 2026

Comment thread packages/web/src/components/pull-request/overview-sidebar.tsx
Cursor Bugbot: when the PR description loaded before the prologue, the
sidebar showed Description, then silently switched to Prologue once it
arrived. Default the active tab from whatever content exists at mount
(via a lazy useState initializer) instead of hardcoding Prologue, so a
later-arriving tab can't steal focus.
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 a965a81. Configure here.

Comment thread packages/cli/src/github/pull-request.ts Outdated
Cursor Bugbot: `gh pr view --json body` emits null (not "") when a PR has
no description, like mergedAt. The schema required a plain string, so Zod
rejected the whole payload and getPullRequest returned null — dropping all
PR context. Accept null at the gh boundary and coerce to "" so the wire
type stays a non-null string. Adds a regression test.
Add "Copy" buttons to the Prologue and Chapters headers (markdown to
clipboard) — the one generation-independent feature from hosted's header
menu. New formatPrologueAsMarkdown / formatAllChaptersAsMarkdown reuse the
existing single-chapter formatter.

Render the PR description's embedded HTML (the "Open in Stage" / cubic
badges bots append) via rehype-raw + rehype-sanitize behind an opt-in
allowHtml prop on Markdown, so it shows like hosted instead of dumping raw
markup as text. Schema extended for <picture>/<source>; scripts/handlers
stripped. Adds unit coverage for the formatters and sanitization.
Mirror hosted Stage: the chapters index uses contained scroll — the page
is height-locked, the PR header and tab nav are fixed, and a flex content
area fills the rest so the prologue/description and chapters panels scroll
independently. Files and chapter detail keep page scroll for their long
diff lists. The layout measures the content area to size the panels via
--main-height and the index grid fills its height.
…focus

Hosted's prologue renders each review-focus location as a plain muted
filename, not a link into the files tab. Replace the scrollTo <Link> (and
its arrow) with a span and drop the now-unused runId prop down the chain
(PrologueSection → OverviewSidebar).
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.

1 participant