diff --git a/.changeset/chat-header-git-diff-stats.md b/.changeset/chat-header-git-diff-stats.md new file mode 100644 index 000000000..e79ab99a1 --- /dev/null +++ b/.changeset/chat-header-git-diff-stats.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-web": minor +--- + +Show git diff line stats in the chat header using green `+N` and red `-N` counts, with a placeholder prop ready for backend wiring. diff --git a/apps/kimi-web/src/App.vue b/apps/kimi-web/src/App.vue index 7f0138f68..6838a482c 100644 --- a/apps/kimi-web/src/App.vue +++ b/apps/kimi-web/src/App.vue @@ -638,6 +638,7 @@ function openPr(url: string): void { :compaction="client.compaction.value" :workspace-name="client.visibleWorkspace.value?.name" :workspace-root="client.visibleWorkspace.value?.root ?? client.status.value.cwd" + :git-diff-stats="null" :workspaces="client.workspacesView.value" :active-workspace-id="client.activeWorkspaceId.value" :session-title="activeSessionTitle" diff --git a/apps/kimi-web/src/components/ChatHeader.vue b/apps/kimi-web/src/components/ChatHeader.vue index a84108dc8..3065a4cc3 100644 --- a/apps/kimi-web/src/components/ChatHeader.vue +++ b/apps/kimi-web/src/components/ChatHeader.vue @@ -19,6 +19,8 @@ const props = defineProps<{ ahead?: number; behind?: number; changesCount?: number; + /** Git diff line stats: additions / deletions. Zero/null values are hidden. */ + gitDiffStats?: { totalAdditions: number; totalDeletions: number } | null; isGitRepo?: boolean; /** GitHub PR for the current branch, when known (null/undefined = none). */ pr?: { number: number; state: string; url: string } | null; @@ -38,6 +40,9 @@ const emit = defineEmits<{ const ahead = computed(() => props.ahead ?? 0); const behind = computed(() => props.behind ?? 0); const changes = computed(() => props.changesCount ?? 0); +const adds = computed(() => props.gitDiffStats?.totalAdditions ?? 0); +const dels = computed(() => props.gitDiffStats?.totalDeletions ?? 0); +const hasLineStats = computed(() => adds.value > 0 || dels.value > 0); // --------------------------------------------------------------------------- // More-menu (kebab dropdown) @@ -265,7 +270,11 @@ function startArchive(): void { {{ branch }} ↑{{ ahead }} ↓{{ behind }} - {{ t('header.changed', { n: changes }) }} + + {{ t('header.changed', { n: changes }) }} @@ -342,6 +351,14 @@ function startArchive(): void { flex: none; color: var(--warn); } +.ch-add { + flex: none; + color: var(--ok); +} +.ch-del { + flex: none; + color: var(--err); +} .ch-spacer { flex: 1; min-width: 0; } .ch-act { diff --git a/apps/kimi-web/src/components/ConversationPane.vue b/apps/kimi-web/src/components/ConversationPane.vue index ffd288e56..db96b9c9b 100644 --- a/apps/kimi-web/src/components/ConversationPane.vue +++ b/apps/kimi-web/src/components/ConversationPane.vue @@ -78,6 +78,8 @@ const props = defineProps<{ workspaceName?: string; /** Absolute workspace root path shown by the Open menu. */ workspaceRoot?: string; + /** Git diff line stats for the header diff counter (mirrors kimi-cli/web). */ + gitDiffStats?: { totalAdditions: number; totalDeletions: number } | null; /** Workspaces for the empty-composer picker (start a conversation elsewhere). */ workspaces?: WorkspaceView[]; /** Active workspace id, to highlight the current entry in the picker. */ @@ -685,6 +687,7 @@ onUnmounted(() => { :ahead="gitInfo?.ahead" :behind="gitInfo?.behind" :changes-count="changesCount" + :git-diff-stats="gitDiffStats" :is-git-repo="!!gitInfo" :pr="pr" :copied="copyConversationCopied"