From e5ba319a5ce89442b7568be4d59f7e7a4d09b2a6 Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Sat, 1 Aug 2026 12:36:57 +0530 Subject: [PATCH 01/19] chore: add contributor email mappings for @Prontsevich --- contributors/emails/prontsevich@gmail.com | 2 ++ contributors/emails/sergey@3dacademysoftware.com | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 contributors/emails/prontsevich@gmail.com create mode 100644 contributors/emails/sergey@3dacademysoftware.com diff --git a/contributors/emails/prontsevich@gmail.com b/contributors/emails/prontsevich@gmail.com new file mode 100644 index 0000000000000..8a6a17bd9cc48 --- /dev/null +++ b/contributors/emails/prontsevich@gmail.com @@ -0,0 +1,2 @@ +Prontsevich +# PR #32811 salvage (ACP background MCP discovery) diff --git a/contributors/emails/sergey@3dacademysoftware.com b/contributors/emails/sergey@3dacademysoftware.com new file mode 100644 index 0000000000000..4e0532fa442cc --- /dev/null +++ b/contributors/emails/sergey@3dacademysoftware.com @@ -0,0 +1,2 @@ +spro-work +# PR #32811 salvage (ACP background MCP discovery) — same person as Prontsevich From 5b4c57a7ffed913ee69ba00c487f0fbe137a1c14 Mon Sep 17 00:00:00 2001 From: Brooklyn Nicholson Date: Sat, 1 Aug 2026 02:32:28 -0500 Subject: [PATCH 02/19] feat(desktop): shared path display collapses home to ~ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit One paint helper for UI chrome: /Users/x/y → ~/y (also /home and C:\Users). Copy/reveal still use the real absolute path. --- apps/desktop/src/lib/display-path.test.ts | 47 +++++++ apps/desktop/src/lib/display-path.ts | 157 ++++++++++++++++++++++ 2 files changed, 204 insertions(+) create mode 100644 apps/desktop/src/lib/display-path.test.ts create mode 100644 apps/desktop/src/lib/display-path.ts diff --git a/apps/desktop/src/lib/display-path.test.ts b/apps/desktop/src/lib/display-path.test.ts new file mode 100644 index 0000000000000..426d8905467cc --- /dev/null +++ b/apps/desktop/src/lib/display-path.test.ts @@ -0,0 +1,47 @@ +import { describe, expect, it } from 'vitest' + +import { displayPath, normalizeDisplayPath, pathLeaf } from './display-path' + +describe('displayPath', () => { + it('collapses a macOS home prefix to ~', () => { + expect(displayPath('/Users/brooklyn/www/hermes-agent')).toBe('~/www/hermes-agent') + expect(displayPath('/Users/brooklyn')).toBe('~') + }) + + it('collapses a Linux home prefix to ~', () => { + expect(displayPath('/home/alice/src/app')).toBe('~/src/app') + }) + + it('collapses a Windows user profile to ~', () => { + expect(displayPath('C:\\Users\\brooklyn\\src')).toBe('~/src') + expect(displayPath('C:/Users/brooklyn')).toBe('~') + }) + + it('honours an explicit home override', () => { + expect(displayPath('/opt/work/repo', { home: '/opt/work' })).toBe('~/repo') + expect(displayPath('/elsewhere/repo', { home: '/opt/work' })).toBe('/elsewhere/repo') + }) + + it('leaves non-home absolute paths alone', () => { + expect(displayPath('/var/log/system.log')).toBe('/var/log/system.log') + expect(displayPath('/Users')).toBe('/Users') + }) + + it('normalizes separators and trailing slashes', () => { + expect(normalizeDisplayPath('C:\\Users\\me\\src\\')).toBe('C:/Users/me/src') + expect(displayPath('/Users/me/src/')).toBe('~/src') + }) + + it('keeps an already-tildified path', () => { + expect(displayPath('~/www/app')).toBe('~/www/app') + expect(displayPath('~')).toBe('~') + }) +}) + +describe('pathLeaf', () => { + it('returns the last segment', () => { + expect(pathLeaf('/Users/me/www/hermes-agent')).toBe('hermes-agent') + expect(pathLeaf('~/www/hermes-agent')).toBe('hermes-agent') + expect(pathLeaf('/')).toBe('/') + }) +}) diff --git a/apps/desktop/src/lib/display-path.ts b/apps/desktop/src/lib/display-path.ts new file mode 100644 index 0000000000000..d065a00d06be6 --- /dev/null +++ b/apps/desktop/src/lib/display-path.ts @@ -0,0 +1,157 @@ +/** + * One place to format filesystem paths for DISPLAY. + * + * Industry standard (shells, VS Code `tildify`, Finder path bar): collapse the + * user's home directory to `~`, keep forward slashes, leave everything else + * alone. Copy/reveal/IPC still use the real absolute path — this is paint only. + * + * When `home` is unknown (renderer has no `os.homedir()` and remote cwd may + * not match the local machine), a conservative heuristic still collapses the + * common `/Users/`, `/home/`, and `C:/Users/` prefixes so a + * long absolute path never paints raw in chrome. + */ + +export interface DisplayPathOptions { + /** Explicit home directory to collapse (local machine home, remote $HOME). */ + home?: null | string +} + +/** Normalize separators and drop a trailing slash (except root / drive root). */ +export function normalizeDisplayPath(raw: string): string { + let path = (raw || '').trim().replace(/\\/g, '/') + + if (!path) { + return '' + } + + // Collapse repeated slashes, but keep a leading UNC `//server/...` pair. + if (path.startsWith('//')) { + path = `//${path.slice(2).replace(/\/{2,}/g, '/')}` + } else { + path = path.replace(/\/{2,}/g, '/') + } + + // Drop trailing slash except bare `/` or `C:/`. + if (path.length > 1 && path.endsWith('/') && !/^[A-Za-z]:\/$/.test(path)) { + path = path.replace(/\/+$/, '') + } + + return path +} + +function normalizeHome(home: string): string { + const normalized = normalizeDisplayPath(home) + + if (!normalized) { + return '' + } + + // Home itself should not keep a trailing slash for prefix checks. + return normalized.replace(/\/+$/, '') +} + +function startsWithHome(path: string, home: string, caseInsensitive: boolean): boolean { + if (!home) { + return false + } + + if (path === home) { + return true + } + + const prefix = `${home}/` + + return caseInsensitive + ? path.toLowerCase().startsWith(prefix.toLowerCase()) || path.toLowerCase() === home.toLowerCase() + : path.startsWith(prefix) || path === home +} + +/** + * Best-effort home prefix when callers don't pass one. Matches the usual + * single-user layouts; never collapses `/Users` or `/home` alone. + */ +function inferredHomePrefix(path: string): string { + // macOS: /Users/name[/...] + let match = path.match(/^(\/Users\/[^/]+)(?:\/|$)/) + + if (match) { + return match[1] + } + + // Linux (and most UNIX): /home/name[/...] + match = path.match(/^(\/home\/[^/]+)(?:\/|$)/) + + if (match) { + return match[1] + } + + // Windows user profile: C:/Users/name[/...] (also works after \ → /) + match = path.match(/^([A-Za-z]:\/Users\/[^/]+)(?:\/|$)/) + + if (match) { + return match[1] + } + + return '' +} + +/** + * Format a filesystem path for UI chrome. + * + * /Users/brooklyn/www/hermes-agent → ~/www/hermes-agent + * /Users/brooklyn → ~ + * C:\Users\brooklyn\src → ~/src + * /var/log → /var/log + * already/relative → already/relative + */ +export function displayPath(raw: null | string | undefined, options: DisplayPathOptions = {}): string { + const path = normalizeDisplayPath(raw || '') + + if (!path) { + return '' + } + + // Already tildified — normalize only. + if (path === '~' || path.startsWith('~/')) { + return path + } + + const explicitHome = options.home ? normalizeHome(options.home) : '' + // Windows paths are case-insensitive; POSIX paths with an explicit home keep + // case-sensitive matching (Linux). Heuristic homes on mac/win ignore case. + const home = explicitHome || inferredHomePrefix(path) + + if (!home) { + return path + } + + const caseInsensitive = !explicitHome || /^[A-Za-z]:\//.test(home) || home.startsWith('/Users/') + + if (!startsWithHome(path, home, caseInsensitive)) { + return path + } + + if (path.length === home.length) { + return '~' + } + + return `~${path.slice(home.length)}` +} + +/** Last path segment for compact labels (statusbar leaf, settings rows). */ +export function pathLeaf(raw: null | string | undefined): string { + const path = normalizeDisplayPath(raw || '') + + if (!path || path === '/' || path === '~') { + return path + } + + // `C:/` drive root + if (/^[A-Za-z]:\/$/.test(path) || /^[A-Za-z]:$/.test(path)) { + return path.endsWith('/') ? path : `${path}/` + } + + const leaf = path.split('/').filter(Boolean).pop() + + return leaf || path +} From 3707741d9f77de340c2eaf1b1332ca62f9ebe262 Mon Sep 17 00:00:00 2001 From: Brooklyn Nicholson Date: Sat, 1 Aug 2026 02:32:28 -0500 Subject: [PATCH 03/19] fix(desktop): statusbar cwd follows the focused session Workspace indicator was stuck on the primary $currentCwd while timers and context already tracked focus. Resolve from the focused runtime slice, then the stored session row, with a mid-switch ownership gate. Path tips across chrome use displayPath (~/). --- .../chat/composer/status-stack/coding-row.tsx | 13 +++ .../chat/sidebar/projects/entered-content.tsx | 3 +- .../chat/sidebar/projects/workspace-group.tsx | 3 +- apps/desktop/src/app/profiles/index.tsx | 5 +- .../app/right-sidebar/files/remote-picker.tsx | 5 +- .../app/right-sidebar/review/file-tree.tsx | 3 +- .../src/app/right-sidebar/review/index.tsx | 9 +- .../src/app/settings/sessions-settings.tsx | 19 +-- .../app/shell/hooks/use-statusbar-items.tsx | 108 +++++++++++++----- .../thread/changed-files-card.tsx | 3 +- 10 files changed, 111 insertions(+), 60 deletions(-) diff --git a/apps/desktop/src/app/chat/composer/status-stack/coding-row.tsx b/apps/desktop/src/app/chat/composer/status-stack/coding-row.tsx index 1296b3fb18037..32b21952db9bb 100644 --- a/apps/desktop/src/app/chat/composer/status-stack/coding-row.tsx +++ b/apps/desktop/src/app/chat/composer/status-stack/coding-row.tsx @@ -15,6 +15,7 @@ import { Codicon } from '@/components/ui/codicon' import { DiffCount } from '@/components/ui/diff-count' import type { HermesGitBranch } from '@/global' import { useI18n } from '@/i18n' +import { displayPath } from '@/lib/display-path' import { registerRepoStatusCwd, repoStatusForCwd, repoWorktreesForCwd } from '@/store/coding-status' import { notifyError } from '@/store/notifications' import { $newWorktreeRequest } from '@/store/projects' @@ -237,6 +238,18 @@ export const CodingStatusRow = memo(function CodingStatusRow({ + {/* Worktree path — plain muted text, not a chip. Always in the flex + so hover doesn't reflow the row; opacity alone reveals it. + `displayPath` collapses home → ~ (shell / VS Code convention). */} + {resolvedRepoPath && ( + + {displayPath(resolvedRepoPath)} + + )} + {/* Branch actions kebab — same pattern as the session/worktree rows. ALWAYS laid out; only its opacity flips on hover/focus/open, so revealing it never reflows the row (no layout shift). pointer-events diff --git a/apps/desktop/src/app/chat/sidebar/projects/entered-content.tsx b/apps/desktop/src/app/chat/sidebar/projects/entered-content.tsx index 9d32259316378..6b09788157b70 100644 --- a/apps/desktop/src/app/chat/sidebar/projects/entered-content.tsx +++ b/apps/desktop/src/app/chat/sidebar/projects/entered-content.tsx @@ -15,6 +15,7 @@ import { import type { HermesGitWorktree } from '@/global' import type { SessionInfo } from '@/hermes' import { useI18n } from '@/i18n' +import { displayPath } from '@/lib/display-path' import { $dismissedWorktreeIds, dismissWorktree, setWorkspaceNodeOpen } from '@/store/layout' import { notifyError } from '@/store/notifications' import { removeWorktreePath } from '@/store/projects' @@ -277,7 +278,7 @@ function RepoFlatSection({ label={repo.label} onToggle={toggleOpen} open={open} - title={repo.path ?? undefined} + title={repo.path ? displayPath(repo.path) : undefined} /> {open && {body}} {removeDialog} diff --git a/apps/desktop/src/app/chat/sidebar/projects/workspace-group.tsx b/apps/desktop/src/app/chat/sidebar/projects/workspace-group.tsx index dd38e84a2b9c0..5c05869b5a707 100644 --- a/apps/desktop/src/app/chat/sidebar/projects/workspace-group.tsx +++ b/apps/desktop/src/app/chat/sidebar/projects/workspace-group.tsx @@ -4,6 +4,7 @@ import { useState } from 'react' import { Codicon } from '@/components/ui/codicon' import type { SessionInfo } from '@/hermes' import { useI18n } from '@/i18n' +import { displayPath } from '@/lib/display-path' import { setWorkspaceNodeOpen } from '@/store/layout' import { notifyError } from '@/store/notifications' import { newSessionInProfile } from '@/store/profile' @@ -132,7 +133,7 @@ export function SidebarWorkspaceGroup({ group, renderRows, onNewSession, onRemov label={group.label} onToggle={toggleOpen} open={open} - title={group.path ?? undefined} + title={group.path ? displayPath(group.path) : undefined} /> {open && ( diff --git a/apps/desktop/src/app/profiles/index.tsx b/apps/desktop/src/app/profiles/index.tsx index 1db67b8778e3a..ae2ee9aab52dc 100644 --- a/apps/desktop/src/app/profiles/index.tsx +++ b/apps/desktop/src/app/profiles/index.tsx @@ -9,6 +9,7 @@ import { Codicon } from '@/components/ui/codicon' import { getProfileSoul, type ProfileInfo, updateProfileSoul } from '@/hermes' import { useI18n } from '@/i18n' import { AlertTriangle, Save } from '@/lib/icons' +import { displayPath } from '@/lib/display-path' import { profileColorSoft, resolveProfileColor } from '@/lib/profile-color' import { normalize } from '@/lib/text' import { notify, notifyError } from '@/store/notifications' @@ -258,8 +259,8 @@ function ProfileDetail({ profile }: { profile: ProfileInfo }) { {profile.is_default && {p.defaultBadge}} {profile.has_env && .env} -

- {profile.path} +

+ {displayPath(profile.path)}

diff --git a/apps/desktop/src/app/right-sidebar/files/remote-picker.tsx b/apps/desktop/src/app/right-sidebar/files/remote-picker.tsx index b502c014c7dd9..3374348e20fb1 100644 --- a/apps/desktop/src/app/right-sidebar/files/remote-picker.tsx +++ b/apps/desktop/src/app/right-sidebar/files/remote-picker.tsx @@ -5,6 +5,7 @@ import { Codicon } from '@/components/ui/codicon' import { Dialog, DialogContent, DialogDescription, DialogTitle } from '@/components/ui/dialog' import { useI18n } from '@/i18n' import { readDesktopDir, setDesktopFsRemotePicker } from '@/lib/desktop-fs' +import { displayPath, pathLeaf } from '@/lib/display-path' import { cn } from '@/lib/utils' function clean(path: string) { @@ -24,7 +25,7 @@ function parentDir(path: string) { } function pathName(path: string) { - return path.split('/').filter(Boolean).pop() || path + return pathLeaf(path) || path } interface PendingSelection { @@ -167,7 +168,7 @@ export function RemoteFolderPicker() {
-
{currentPath}
+
{displayPath(currentPath)}