feat: add prologue support to chapters schema, storage, and UI#29
Conversation
The prologue is an optional high-level overview (motivation, outcome, key changes, focus areas, complexity) that the coding agent generates alongside chapters. It flows through the same JSON file → import → API → frontend pipeline as chapters. - Add Prologue types to @stage-cli/types with as-const enums - Add nullable prologue JSON column to chapter_run table (migration 0004) - Extend ChaptersFileSchema with optional prologue field - Store prologue during import, serve in /api/runs/:runId/chapters response - Add PrologueSection component displayed above chapter list - Extract buildDiffArgs into git.ts for reuse - Add Step 4 to SKILL.md with prologue generation instructions
There was a problem hiding this comment.
Code Review
This pull request introduces a "prologue" feature to provide high-level summaries of code changes, including motivation, outcomes, and focus areas. The implementation spans database schema updates, API enhancements, and a new frontend display component. Feedback includes restoring a lost explanatory comment in the git utility, enforcing array length constraints in the Zod schema to align with documentation, and correcting a non-standard Tailwind CSS class in the UI.
Replace ml-5.5 with ml-6 for the focus area description margin.
Each field is independently nullable — render whichever is present rather than requiring both.
Match the hosted Stage monorepo's layout: prologue in a sticky left sidebar (2:3 grid ratio) with chapters on the right, stacking vertically on smaller screens. Show all focus areas in Review Focus, not just concerns. Info-level items now render with a blue info icon instead of being filtered out.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f7c20fa. Configure here.
Match the hosted Stage monorepo — only show non-info severity focus areas in the Review Focus section.
Each focus area's first location renders as a clickable filename that navigates to the Files changed tab, matching the hosted Stage monorepo's pattern.
Add scrollTo search param to the Files route. When a focus area's file link is clicked, it navigates to Files changed and scrolls to that specific file, matching the hosted Stage monorepo's behavior.

Summary
Vendors the prologue feature from the hosted Stage monorepo, adapted for stage-cli's local architecture. The prologue is an optional high-level overview of a code change (motivation, outcome, key changes, focus areas, complexity) that the coding agent generates alongside chapters. It flows through the same JSON → import → API → frontend pipeline.
Changes
Prologuewire-format types to@stage-cli/typeswithas constenums for focus area types, severities, and complexity levelsprologueJSON column tochapter_runtable (migration 0004)ChaptersFileSchemawith an optionalprologuefield (backward-compatible — existing JSON without prologue still validates)/api/runs/:runId/chaptersresponse (no new endpoint)PrologueSectioncomponent that renders above the chapter list when a prologue is presentbuildDiffArgsfromdiff.tsintogit.tsfor reuseSKILL.mdwith writing guidelines ported from the hosted monorepo's summary-agent promptTesting
pnpm typecheck && pnpm lintclean