agent-ecosystem/src/renderer/components/team/review/ConfidenceBadge.tsx
iliya 190cafdb8e feat: implement diff view with 4 phases — review, accept/reject, task scoping, enhanced UX
Phase 1: Core diff extraction and display
- ChangeExtractorService: JSONL streaming parser with snippet extraction
- FileContentResolver: 3-level content resolution (file-history → snippets → disk)
- ReviewApplierService: hunk-level accept/reject with conflict detection
- CodeMirrorDiffView: unified merge view with syntax highlighting
- ReviewFileTree: file browser with status indicators
- changeReviewSlice: Zustand state for review workflow

Phase 2: Interactive review with accept/reject
- Per-hunk and per-file accept/reject decisions
- Conflict checking before apply
- ReviewToolbar with bulk actions
- DiffErrorBoundary for graceful degradation

Phase 3: Per-task change scoping
- TaskBoundaryParser: detects task boundaries in JSONL (Tier 1-4 confidence)
- TaskChangeSetV2 with scope + warnings
- ConfidenceBadge and ScopeWarningBanner components

Phase 4: Enhanced features
- Keyboard navigation (j/k/n/p/a/x shortcuts via useDiffNavigation)
- Viewed file tracking (localStorage + useViewedFiles hook)
- File edit timeline (chronological events per file)
- Git fallback (GitDiffFallback service for incomplete JSONL data)
- Auto-viewed detection (IntersectionObserver sentinel)
2026-02-24 23:39:41 +02:00

31 lines
969 B
TypeScript

import type { TaskScopeConfidence } from '@shared/types';
interface ConfidenceBadgeProps {
confidence: TaskScopeConfidence;
showTooltip?: boolean;
}
const TIER_COLORS: Record<number, string> = {
1: 'bg-green-500/20 text-green-400 border-green-500/30',
2: 'bg-yellow-500/20 text-yellow-400 border-yellow-500/30',
3: 'bg-orange-500/20 text-orange-400 border-orange-500/30',
4: 'bg-red-500/20 text-red-400 border-red-500/30',
};
const TIER_LABELS: Record<number, string> = {
1: 'High confidence',
2: 'Medium confidence',
3: 'Low confidence',
4: 'Best effort',
};
export const ConfidenceBadge = ({ confidence, showTooltip = true }: ConfidenceBadgeProps) => {
return (
<span
className={`inline-flex items-center rounded border px-2 py-0.5 text-xs ${TIER_COLORS[confidence.tier] ?? TIER_COLORS[4]}`}
title={showTooltip ? confidence.reason : undefined}
>
{TIER_LABELS[confidence.tier] ?? TIER_LABELS[4]}
</span>
);
};