Skip to content

The agent that grows with you

feat(desktop): add 'Copy full changelog' button to updates overlay

Weidowsc395693c8553
diff --git a/apps/desktop/src/app/updates-overlay.tsx b/apps/desktop/src/app/updates-overlay.tsx
index d6b1e8713ae..948175feee2 100644
--- a/apps/desktop/src/app/updates-overlay.tsx
+++ b/apps/desktop/src/app/updates-overlay.tsx
@@ -25,10 +25,10 @@ import type {
UpdaterMechanismClient
} from '@/global'
import { useI18n } from '@/i18n'
-import { buildCommitChangelog, type CommitGroup } from '@/lib/commit-changelog'
-import { AlertCircle, Check, Copy, Terminal } from '@/lib/icons'
-import { resolveUpdateCopy, type UpdateTarget } from '@/lib/update-copy'
+import { buildCommitChangelog, parseCommitHeader, type CommitGroup } from '@/lib/commit-changelog'
+import { AlertCircle, Check, CheckCircle2, Copy, Terminal } from '@/lib/icons'
import { cn } from '@/lib/utils'
+import { resolveUpdateCopy, type UpdateTarget } from '@/lib/update-copy'
import {
$backendUpdateApply,
$backendUpdateChecking,
@@ -55,6 +55,26 @@ 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)
@@ -295,6 +315,15 @@ function IdleView({
copy: u
})
+ const [logCopied, setLogCopied] = useState(false)
+
+ const handleCopyFullLog = () => {
+ void writeClipboardText(formatFullChangelogText(commits, behind, status.branch)).then(() => {
+ setLogCopied(true)
+ window.setTimeout(() => setLogCopied(false), 1800)
+ })
+ }
+
return (
<div className="grid gap-5 px-6 pb-6 pt-7 pr-8">
<div className="flex flex-col items-center gap-3 text-center">
@@ -320,6 +349,26 @@ function IdleView({
))}
</div>
+ {commits.length > 0 && (
+ <button
+ className="group flex w-full items-center justify-center gap-2 rounded-lg border border-border/50 bg-transparent px-3 py-2 text-xs font-medium text-muted-foreground transition-colors hover:border-border hover:bg-muted/30 hover:text-foreground"
+ onClick={handleCopyFullLog}
+ type="button"
+ >
+ {logCopied ? (
+ <>
+ <Check className="size-3.5 text-emerald-600 dark:text-emerald-400" />
+ {u.copied}
+ </>
+ ) : (
+ <>
+ <Copy className="size-3.5" />
+ {u.copyFullLog}
+ </>
+ )}
+ </button>
+ )}
+
<div className="grid gap-2">
<Button className="font-semibold" onClick={onInstall} size="lg">
{u.updateNow}
diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.ts
index 1b78cac8b14..f52e7a8798c 100644
--- a/apps/desktop/src/i18n/en.ts
+++ b/apps/desktop/src/i18n/en.ts
@@ -4198,6 +4198,7 @@ export const en: Translations = {
updateNow: 'Update now',
maybeLater: 'Maybe later',
moreChanges: count => `+ ${count} more change${count === 1 ? '' : 's'} included.`,
+ copyFullLog: 'Copy full changelog',
manualTitle: 'Update from your terminal',
manualUnavailableTitle: "Can't update from here",
manualBody: 'You installed Hermes from the command line, so updates run there too. Paste this into your terminal:',
diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.ts
index cd527bc6fb3..ac9dd579db0 100644
--- a/apps/desktop/src/i18n/types.ts
+++ b/apps/desktop/src/i18n/types.ts
@@ -3484,6 +3484,7 @@ export interface Translations {
updateNow: string
maybeLater: string
moreChanges: (count: number) => string
+ copyFullLog: string
manualTitle: string
manualUnavailableTitle: string
manualBody: string
diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.ts
index d1dd02f5a8b..4e8eef3cc91 100644
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@ -3957,6 +3957,7 @@ export const zh = defineLocale({
updateNow: '立即更新',
maybeLater: '稍后再说',
moreChanges: count => `另有 ${count} 项更改。`,
+ copyFullLog: '复制完整更新日志',
manualTitle: '从终端更新',
manualUnavailableTitle: '无法从这里更新',
manualBody: '你是从命令行安装的 Hermes,因此更新也需要在那里运行。请将此命令粘贴到终端:',