The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): address review feedback for full changelog copy
Weidows542fd83d7b85
diff --git a/apps/desktop/src/app/updates-overlay.tsx b/apps/desktop/src/app/updates-overlay.tsxindex 948175feee2..e3f11ae7a00 100644--- a/apps/desktop/src/app/updates-overlay.tsx+++ b/apps/desktop/src/app/updates-overlay.tsx@@ -25,8 +25,8 @@ import type {UpdaterMechanismClient} from '@/global'import { useI18n } from '@/i18n'-import { buildCommitChangelog, parseCommitHeader, type CommitGroup } from '@/lib/commit-changelog'-import { AlertCircle, Check, CheckCircle2, Copy, Terminal } from '@/lib/icons'+import { buildCommitChangelog, formatFullChangelogText, type CommitGroup } from '@/lib/commit-changelog'+import { AlertCircle, Check, Copy, Terminal } from '@/lib/icons'import { cn } from '@/lib/utils'import { resolveUpdateCopy, type UpdateTarget } from '@/lib/update-copy'import {@@ -55,26 +55,6 @@ function totalItems(groups: readonly CommitGroup[]) {return groups.reduce((sum, g) => sum + g.items.length, 0)}-function formatFullChangelogText(commits: readonly DesktopUpdateCommit[], behind: number, branch: string | undefined): string {- const lines: string[] = ['=== Hermes Update Changelog ===']- if (behind > 0) {- lines.push(`Behind by ${behind} commit${behind === 1 ? '' : 's'}${branch ? ` on branch ${branch}` : ''}`)- }- lines.push('')-- for (const c of commits) {- const parsed = parseCommitHeader(c.summary ?? '')- const prefix = parsed.type ? (parsed.breaking ? `${parsed.type}!` : parsed.type) : ''- const scope = parsed.scope ? `(${parsed.scope})` : ''- const tag = prefix + scope- const subject = parsed.subject || c.summary || ''- const line = tag ? `${tag}: ${subject} — ${c.author}` : `${subject} — ${c.author}`- lines.push(line)- }-- return lines.join('\n')-}-export function UpdatesOverlay() {const open = useStore($updateOverlayOpen)const target = useStore($updateOverlayTarget)diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.tsindex e7279dc4f8e..a40efa70de2 100644--- a/apps/desktop/src/i18n/ja.ts+++ b/apps/desktop/src/i18n/ja.ts@@ -3054,6 +3054,7 @@ export const ja = defineLocale({updateNow: '今すぐ更新',maybeLater: '後で',moreChanges: count => `さらに ${count} 件の変更が含まれています。`,+ copyFullLog: '完全な変更ログをコピー',manualTitle: 'ターミナルから更新',manualUnavailableTitle: 'ここからは更新できません',manualBody:diff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.tsindex a21d674703d..fd3a473f26a 100644--- a/apps/desktop/src/i18n/zh-hant.ts+++ b/apps/desktop/src/i18n/zh-hant.ts@@ -3260,6 +3260,7 @@ export const zhHant = defineLocale({updateNow: '立即更新',maybeLater: '稍後再說',moreChanges: count => `另有 ${count} 項變更。`,+ copyFullLog: '複製完整更新日誌',manualTitle: '從終端機更新',manualUnavailableTitle: '無法從這裡更新',manualBody: '您是從命令列安裝的 Hermes,因此更新也需要在那裡執行。請將此指令貼到終端機:',diff --git a/apps/desktop/src/lib/commit-changelog.test.ts b/apps/desktop/src/lib/commit-changelog.test.tsindex b1636ca50f5..8925bf63562 100644--- a/apps/desktop/src/lib/commit-changelog.test.ts+++ b/apps/desktop/src/lib/commit-changelog.test.ts@@ -1,6 +1,6 @@import { describe, expect, it } from 'vitest'-import { buildCommitChangelog, parseCommitHeader } from './commit-changelog'+import { buildCommitChangelog, formatFullChangelogText, parseCommitHeader } from './commit-changelog'describe('parseCommitHeader', () => {it('extracts type, scope, and subject from a conventional header', () => {@@ -113,3 +113,64 @@ describe('buildCommitChangelog', () => {expect(totalItems).toBe(3)})})++describe('formatFullChangelogText', () => {+ it('formats conventional commit lines', () => {+ const result = formatFullChangelogText(+ [{ sha: 'abc', summary: 'feat: add login', author: 'Alice' }],+ 3,+ 'main'+ )+ expect(result).toContain('=== Hermes Update Changelog ===')+ expect(result).toContain('Behind by 3 commits on branch main')+ expect(result).toContain('feat: add login — Alice')+ })++ it('formats scoped commit', () => {+ const result = formatFullChangelogText(+ [{ sha: 'abc', summary: 'fix(api): handle timeout', author: 'Bob' }],+ 0,+ 'main'+ )+ expect(result).toContain('fix(api): handle timeout — Bob')+ })++ it('formats breaking commit with bang after scope', () => {+ const result = formatFullChangelogText(+ [{ sha: 'abc', summary: 'feat(api)!: change endpoint shape', author: 'Carol' }],+ 0+ )+ // Canonical: type(scope)!: not type!(scope):+ expect(result).toContain('feat(api)!: change endpoint shape — Carol')+ expect(result).not.toContain('feat!(api)')+ })++ it('falls back to raw summary for non-conventional headers', () => {+ const result = formatFullChangelogText(+ [{ sha: 'abc', summary: 'fix bug in login', author: 'Dave' }],+ 0+ )+ expect(result).toContain('fix bug in login — Dave')+ })++ it('includes singular behind message when behind === 1', () => {+ const result = formatFullChangelogText(+ [{ sha: 'abc', summary: 'fix: minor', author: 'Eve' }],+ 1+ )+ expect(result).toContain('Behind by 1 commit')+ })++ it('omits branch when not provided', () => {+ const result = formatFullChangelogText(+ [{ sha: 'abc', summary: 'fix: minor', author: 'Eve' }],+ 0+ )+ expect(result).not.toContain('on branch')+ })++ it('handles empty commits list gracefully', () => {+ const result = formatFullChangelogText([], 0, 'main')+ expect(result).toContain('=== Hermes Update Changelog ===')+ })+})diff --git a/apps/desktop/src/lib/commit-changelog.ts b/apps/desktop/src/lib/commit-changelog.tsindex 1a9ca995808..21e363c23c1 100644--- a/apps/desktop/src/lib/commit-changelog.ts+++ b/apps/desktop/src/lib/commit-changelog.ts@@ -190,3 +190,37 @@ export function buildCommitChangelog(return result}++/** Format a full changelog text for clipboard copy.+ *+ * Header: `=== Hermes Update Changelog ===`+ * Behind header: `Behind by N commits on branch X`+ * Each commit: `type(scope)!: subject — author`+ * Breaking commits use canonical `type(scope)!:` not `type!(scope):`.+ */+export function formatFullChangelogText(+ commits: readonly { sha?: string; summary?: string; author?: string }[],+ behind: number,+ branch?: string+): string {+ const lines: string[] = ['=== Hermes Update Changelog ===']++ if (behind > 0) {+ lines.push(`Behind by ${behind} commit${behind === 1 ? '' : 's'}${branch ? ` on branch ${branch}` : ''}`)+ }++ lines.push('')++ for (const c of commits) {+ const parsed = parseCommitHeader(c.summary ?? '')+ const type = parsed.type ?? ''+ const scope = parsed.scope ? `(${parsed.scope})` : ''+ const bang = parsed.breaking ? '!' : ''+ const tag = type + scope + bang+ const subject = parsed.subject || c.summary || ''+ const line = tag ? `${tag}: ${subject} — ${c.author ?? ''}` : `${subject} — ${c.author ?? ''}`+ lines.push(line)+ }++ return lines.join('\n')+}