@@ -9,9 +9,9 @@ import * as Order from "effect/Order";
99
1010export type ReviewSectionKind = "turn" | "working-tree" | "branch-range" ;
1111
12- const DIRTY_WORKTREE_SECTION_ID = "git:working-tree " ;
13- const DIRTY_WORKTREE_TITLE = "Dirty worktree " ;
14- const DIRTY_WORKTREE_SUBTITLE = "Tracked, staged , and untracked worktree changes " ;
12+ const CHANGES_SECTION_ID = "git:branch-range " ;
13+ const CHANGES_TITLE = "Changes " ;
14+ const UNCOMMITTED_SUBTITLE = "Staged, unstaged , and untracked files " ;
1515
1616export interface ReviewSectionItem {
1717 readonly id : string ;
@@ -124,7 +124,7 @@ const readyCheckpointOrder = Order.make<ThreadCheckpointSummary>(
124124
125125function gitSubtitle ( section : ReviewDiffPreviewSource ) : string | null {
126126 if ( section . kind === "working-tree" ) {
127- return DIRTY_WORKTREE_SUBTITLE ;
127+ return UNCOMMITTED_SUBTITLE ;
128128 }
129129 if ( section . baseRef ) {
130130 return `${ section . baseRef } ... ${ section . headRef ?? "HEAD" } ` ;
@@ -443,15 +443,16 @@ export function buildReviewSectionItems(input: {
443443 truncated : section . truncated ,
444444 isLoading : false ,
445445 } ) ) ;
446- const hasDirtyWorktreeItem = gitItems . some ( ( item ) => item . id === DIRTY_WORKTREE_SECTION_ID ) ;
446+ // Changes is the default section, so it holds the place while git sources load.
447+ const hasChangesItem = gitItems . some ( ( item ) => item . id === CHANGES_SECTION_ID ) ;
447448 const visibleGitItems =
448- input . loadingGitSections && ! hasDirtyWorktreeItem
449+ input . loadingGitSections && ! hasChangesItem
449450 ? [
450451 {
451- id : DIRTY_WORKTREE_SECTION_ID ,
452- kind : "working-tree " ,
453- title : DIRTY_WORKTREE_TITLE ,
454- subtitle : DIRTY_WORKTREE_SUBTITLE ,
452+ id : CHANGES_SECTION_ID ,
453+ kind : "branch-range " ,
454+ title : CHANGES_TITLE ,
455+ subtitle : null ,
455456 diff : null ,
456457 isLoading : true ,
457458 } satisfies ReviewSectionItem ,
@@ -462,10 +463,11 @@ export function buildReviewSectionItems(input: {
462463 return [ ...turnItems , ...visibleGitItems ] ;
463464}
464465
466+ /** Prefers Changes, then the first section (a turn when the project is not a git repo). */
465467export function getDefaultReviewSectionId (
466468 sections : ReadonlyArray < ReviewSectionItem > ,
467469) : string | null {
468- return sections [ 0 ] ?. id ?? null ;
470+ return ( sections . find ( ( section ) => section . id === CHANGES_SECTION_ID ) ?? sections [ 0 ] ) ?. id ?? null ;
469471}
470472
471473export function buildReviewParsedDiff (
0 commit comments