feat: Redesign review tab with phase selection, commit navigation, and consolidated toolbar
- Add BranchManager.listCommits() and diffCommit() for commit-level navigation - Add getPhaseReviewCommits and getCommitDiff tRPC procedures - New ReviewHeader: consolidated toolbar with phase selector pills, branch info, stats, integrated preview controls, and approve/reject actions - New CommitNav: horizontal commit strip with "All changes" + individual commits, each showing hash, message, and change stats - Slim down ReviewSidebar: file list only with dimming for out-of-scope files when viewing a single commit - ReviewTab orchestrates all pieces in a single bordered card layout
This commit is contained in:
@@ -11,7 +11,7 @@ import { mkdtempSync, rmSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { simpleGit } from 'simple-git';
|
||||
import type { BranchManager } from './branch-manager.js';
|
||||
import type { MergeResult } from './types.js';
|
||||
import type { MergeResult, BranchCommit } from './types.js';
|
||||
import { createModuleLogger } from '../logger/index.js';
|
||||
|
||||
const log = createModuleLogger('branch-manager');
|
||||
@@ -116,4 +116,28 @@ export class SimpleGitBranchManager implements BranchManager {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async listCommits(repoPath: string, baseBranch: string, headBranch: string): Promise<BranchCommit[]> {
|
||||
const git = simpleGit(repoPath);
|
||||
const logResult = await git.log({ from: baseBranch, to: headBranch, '--stat': null });
|
||||
|
||||
return logResult.all.map((entry) => {
|
||||
const diffStat = entry.diff;
|
||||
return {
|
||||
hash: entry.hash,
|
||||
shortHash: entry.hash.slice(0, 7),
|
||||
message: entry.message,
|
||||
author: entry.author_name,
|
||||
date: entry.date,
|
||||
filesChanged: diffStat?.files?.length ?? 0,
|
||||
insertions: diffStat?.insertions ?? 0,
|
||||
deletions: diffStat?.deletions ?? 0,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
async diffCommit(repoPath: string, commitHash: string): Promise<string> {
|
||||
const git = simpleGit(repoPath);
|
||||
return git.diff([`${commitHash}~1`, commitHash]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user