feat: Vendor hosted Stage into the CLI: generation parity, review UI, and configurability

Merged
DA
4mo ago
+19894-1587

Summary

The hosted product (ReviewStage/stage) is sunsetted; this PR vendors its unported functionality into the CLI so users can continue on stagereview. Everything is ported as closely as possible to the hosted implementation (code, prompts, constants, and tests copied verbatim where the architectures align), based on a six-dimension gap analysis of the two repos' code and git histories.

Changes

Chapter generation — prompts (skills/stage-chapters/SKILL.md)

  • Full risk-classification rubric with riskLevel/riskReasons outputs (hosted #896)
  • Prologue rootCause section (hosted #1051), chapter-level mermaid diagram guidance (hosted #771)
  • Restored hosted's full exemplar density, PR title/body + additional-instructions context, keyChange inline-markdown rule

Chapter generation — pipeline & data model (packages/cli, packages/types)

  • No-newline markers filtered from parsed hunks (hosted #1132) with regression tests
  • Hosted ignore semantics: full DEFAULT_IGNORE_PATTERNS (7 new lockfiles, #871), one case-insensitive matcher so .stageignore ! negations re-include defaults
  • Zero-hunk files (pure renames) included in Other Changes via the header-only sentinel
  • riskLevel/riskReasons + rootCause across types, DB (+migration), ingestion, routes
  • What-to-Review ordering by file order then start line (#865/#970); dense 0-based chapterIndex
  • prep: PULL REQUEST (title/body, 4k cap), STATS, and ADDITIONAL INSTRUCTIONS sections (.stageinstructions file + --instructions flag, hosted #1036 analog)
  • Repair-not-reject line refs; pre-assembled chapter files no longer bypass validation; literal-\n unescaping; consistent diff prefixes

Review UI (packages/web)

  • Activity tab: conversation timeline (gh-api-backed), review cards, review-comment diff previews (#1105), events column, read-only reactions
  • Continuous chapter review mode (Page/Scroll, #1083) with active-chapter preservation on mode switch
  • Risk badges, per-chapter/per-file comment counts, remaining-review-lines sticky header (#1107)
  • Markdown stack: shiki highlighting (#796/#826), mermaid in chapter summaries (#771), GitHub image proxy for private attachments (#820)
  • Diff extras: image diffs (base64 over the wire), full previews for moved files (#1106), virtualized file list, minimize inline comments
  • Small fixes: bot reviewer badges (#1131), resolve-button placement (#1133), sticky-header z-index (#1019), CI popover scroll (#1061), min-height floor (#1014), annotation tinting (#757/#1016), index j/k (#835), dark default theme (#819), derived chapter viewed state (#1021)
  • GitHub: stale pending-review recovery (#1072), label management (#1071)
  • GitHub viewed-file sync: marks/unmarks files on GitHub per hosted's rules and unions GitHub's viewed state into the local view state (PR runs, best-effort)
  • Merge: ruleset-aware allowed merge methods (#1057), single inline merge action with status chip and queue position (#1052)
  • Stacked-PR detection and navigation with ⌘⇧↑/⌘⇧↓ (#1049); entries with a local run navigate to it, others link to GitHub
  • Review panel keyboard shortcuts: ⌘J toggle, ⌘↩ submit

Configurability

  • Diff typography (font/size/line height/ligatures, #974), per-app-theme syntax themes (62), app text size (#1038), chapter panel position (#898), What-to-Review visibility (#1077)

Descoped (depend on hosted backends): Stagent chat, ⌘K action board, reaction toggling, timeline-side comment mutations, mobile layouts, AI chapter editing/regeneration UI.

Testing

  • pnpm typecheck, pnpm lint, pnpm test all green (73 files, 643 tests — including regression suites ported from hosted for the diff parser, file filtering, other-changes, line-ref repair, remaining-line counts, timeline assembly, full-file previews, and review recovery)
  • pnpm build (SPA + CLI bundle) succeeds

Open workspace in Conductor


Summary by cubic

Vendors the hosted Stage experience into the CLI so teams can keep using stagereview after the hosted app sunset, with generation parity, a full review UI, GitHub viewed-file sync, labels/stack/merge parity, and configurable display/settings. Also aligns the continuous chapter panel header with paged mode by reusing the shared chapter navigator, with in-page navigation to avoid remounts.

  • Bug Fixes

    • Drop stale comment‑draft store writes that settle after stack navigation.
    • Count outdated GitHub review threads via their original coordinates and carry them as a null‑anchored variant so file and chapter comment badges stay accurate.
    • Restore j/k navigation and scroll‑into‑view by typing the --content-top CSS variable, fixing keyboard and deep‑link scrolling in Files and chapter pages.
  • Refactors

    • Drop the legacy syntax‑theme localStorage migration; the curated single‑key setting now resets to defaults on upgrade. Remove hosted‑Stage provenance comments (no behavior change).