Skip to content

feat: add prologue support to chapters schema, storage, and UI#29

Merged
dastratakos merged 7 commits into
mainfrom
dastratakos/vendor-prologue-feature
May 4, 2026
Merged

feat: add prologue support to chapters schema, storage, and UI#29
dastratakos merged 7 commits into
mainfrom
dastratakos/vendor-prologue-feature

Conversation

@dastratakos

@dastratakos dastratakos commented May 4, 2026

Copy link
Copy Markdown
Contributor

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

  • Add Prologue wire-format types to @stage-cli/types with as const enums for focus area types, severities, and complexity levels
  • Add nullable prologue JSON column to chapter_run table (migration 0004)
  • Extend ChaptersFileSchema with an optional prologue field (backward-compatible — existing JSON without prologue still validates)
  • Store prologue during import, serve it in the existing /api/runs/:runId/chapters response (no new endpoint)
  • Add PrologueSection component that renders above the chapter list when a prologue is present
  • Extract buildDiffArgs from diff.ts into git.ts for reuse
  • Add Step 4 ("Generate prologue") to SKILL.md with writing guidelines ported from the hosted monorepo's summary-agent prompt

Testing

  • 7 new tests covering schema validation (accepts/rejects prologue), import flow (stores prologue or null), and API response (includes prologue in chapters endpoint)
  • All 146 existing tests continue to pass
  • pnpm typecheck && pnpm lint clean

Open in Stage

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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/cli/src/git.ts
Comment thread packages/types/src/prologue.ts
Comment thread packages/web/src/components/prologue/prologue-section.tsx Outdated
Replace ml-5.5 with ml-6 for the focus area description margin.
Comment thread packages/web/src/components/prologue/prologue-section.tsx Outdated
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.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 2 potential issues.

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 f7c20fa. Configure here.

Comment thread packages/web/src/app/runs.$runId.index.tsx
Comment thread packages/web/src/components/prologue/prologue-section.tsx
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.
@dastratakos dastratakos marked this pull request as ready for review May 4, 2026 20:24
@dastratakos dastratakos merged commit 334bb11 into main May 4, 2026
5 checks passed
@dastratakos dastratakos deleted the dastratakos/vendor-prologue-feature branch May 4, 2026 20:25
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