Skip to content

The agent that grows with you

fix(desktop): distinguish auto-discovered repos from explicit projects in the sidebar overview

David Metcalfe03b5460ad960
diff --git a/apps/desktop/src/app/chat/sidebar/projects/overview-row.test.tsx b/apps/desktop/src/app/chat/sidebar/projects/overview-row.test.tsx
index 5467b7be86a..0465336629d 100644
--- a/apps/desktop/src/app/chat/sidebar/projects/overview-row.test.tsx
+++ b/apps/desktop/src/app/chat/sidebar/projects/overview-row.test.tsx
@@ -17,7 +17,8 @@ vi.mock('@/i18n', () => ({
projects: {
enter: (label: string) => `Enter ${label}`,
reorder: (label: string) => `Reorder ${label}`,
- toggle: (label: string, open: boolean) => `${open ? 'Show' : 'Hide'} ${label} sessions`
+ toggle: (label: string, open: boolean) => `${open ? 'Show' : 'Hide'} ${label} sessions`,
+ autoDiscovered: 'Auto-discovered'
}
}
}
@@ -92,4 +93,34 @@ describe('ProjectOverviewRow', () => {
expect(container.querySelector('[data-sessions-project="p1"]')).toBeTruthy()
})
+
+ it('renders the folder-library lead glyph for explicit projects', () => {
+ const explicit = { id: 'p1', label: 'Explicit', isAuto: false } as unknown as SidebarProjectTree
+
+ const { container } = render(<ProjectOverviewRow project={explicit} />)
+
+ expect(container.querySelector('.codicon-folder-library')).toBeTruthy()
+ expect(container.querySelector('.codicon-repo')).toBeNull()
+ })
+
+ it('defaults to the folder-library lead glyph when isAuto is absent (explicit nodes omit it)', () => {
+ const explicit = { id: 'p1', label: 'Explicit' } as unknown as SidebarProjectTree
+
+ const { container } = render(<ProjectOverviewRow project={explicit} />)
+
+ expect(container.querySelector('.codicon-folder-library')).toBeTruthy()
+ expect(container.querySelector('.codicon-repo')).toBeNull()
+ })
+
+ it('renders the repo lead glyph and an "Auto-discovered" tooltip for auto projects', () => {
+ const auto = { id: '/Users/dev/my-repo', label: 'my-repo', isAuto: true } as unknown as SidebarProjectTree
+
+ const { container } = render(<ProjectOverviewRow project={auto} />)
+
+ expect(container.querySelector('.codicon-repo')).toBeTruthy()
+ expect(container.querySelector('.codicon-folder-library')).toBeNull()
+
+ const link = screen.getByRole('button', { name: 'Enter my-repo' })
+ expect(tipTrigger(link)).toBeTruthy()
+ })
})
diff --git a/apps/desktop/src/app/chat/sidebar/projects/overview-row.tsx b/apps/desktop/src/app/chat/sidebar/projects/overview-row.tsx
index 8f92767b130..acc40f8903b 100644
--- a/apps/desktop/src/app/chat/sidebar/projects/overview-row.tsx
+++ b/apps/desktop/src/app/chat/sidebar/projects/overview-row.tsx
@@ -3,6 +3,7 @@ import { useRef } from 'react'
import { type NewSessionSplitHandler, startNewSessionDrag } from '@/app/chat/new-session-drag'
import { Codicon } from '@/components/ui/codicon'
+import { Tip } from '@/components/ui/tooltip'
import type { SessionInfo } from '@/hermes'
import { useI18n } from '@/i18n'
import { cn } from '@/lib/utils'
@@ -27,7 +28,10 @@ import { WorkspaceAddButton } from './workspace-header'
// A bare color dot (no icon) or an icon glyph — tinted by `color` when set, else
// the lead's default tertiary. The glyph wrapper centers + caps size either way.
-export function projectIcon({ color, icon, isNoProject }: SidebarProjectTree) {
+// Auto-discovered repos (git lanes Desktop found by scanning disk, not rows in
+// projects.db) get the `repo` glyph so a glance tells explicit projects
+// (`folder-library`) apart from incidental disk/session findings.
+export function projectIcon({ color, icon, isAuto, isNoProject }: SidebarProjectTree) {
if (color && !icon) {
return (
<SidebarRowLeadGlyph>
@@ -38,7 +42,10 @@ export function projectIcon({ color, icon, isNoProject }: SidebarProjectTree) {
return (
<SidebarRowLeadGlyph style={color ? { color } : undefined}>
- <Codicon name={icon || (isNoProject ? 'home' : 'folder-library')} size={SIDEBAR_LEAD_ICON_SIZE} />
+ <Codicon
+ name={icon || (isNoProject ? 'home' : isAuto ? 'repo' : 'folder-library')}
+ size={SIDEBAR_LEAD_ICON_SIZE}
+ />
</SidebarRowLeadGlyph>
)
}
@@ -115,6 +122,16 @@ export function ProjectOverviewRow({
<SidebarRowLead>{projectIcon(project)}</SidebarRowLead>
)
+ const labelLink = (
+ <SidebarRowLink
+ aria-label={s.projects.enter(project.label)}
+ labelClassName={cn('hover:text-foreground hover:underline', isActive && 'text-foreground')}
+ onClick={() => onEnter?.(project.id)}
+ >
+ {project.label}
+ </SidebarRowLink>
+ )
+
const shell = (
<SidebarGroupRow
actions={
@@ -155,15 +172,7 @@ export function ProjectOverviewRow({
}
className={cn(dragging && 'cursor-grabbing bg-(--ui-sidebar-surface-background)')}
data-glass-opaque={dragging ? '' : undefined}
- label={
- <SidebarRowLink
- aria-label={s.projects.enter(project.label)}
- labelClassName={cn('hover:text-foreground hover:underline', isActive && 'text-foreground')}
- onClick={() => onEnter?.(project.id)}
- >
- {project.label}
- </SidebarRowLink>
- }
+ label={project.isAuto ? <Tip label={s.projects.autoDiscovered}>{labelLink}</Tip> : labelLink}
lead={lead}
// The label is grab surface too, not just the lead's grabber — same
// listeners, minus the controls that keep their own gestures. A project
diff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.ts
index 3ea949c3e64..82033660539 100644
--- a/apps/desktop/src/i18n/ar.ts
+++ b/apps/desktop/src/i18n/ar.ts
@@ -1781,6 +1781,7 @@ export const ar = defineLocale({
projects: {
sectionLabel: 'المشاريع',
home: 'الرئيسية',
+ autoDiscovered: 'مكتشف تلقائيًا',
newButton: 'مشروع جديد',
createTitle: 'مشروع جديد',
createDesc: 'سمِّ مساحة العمل وأضف مجلدا أو أكثر.',
diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.ts
index 0a6ae26a41a..a90f7d41256 100644
--- a/apps/desktop/src/i18n/en.ts
+++ b/apps/desktop/src/i18n/en.ts
@@ -2439,6 +2439,7 @@ export const en: Translations = {
projects: {
sectionLabel: 'Projects',
home: 'Home',
+ autoDiscovered: 'Auto-discovered',
newButton: 'New project',
createTitle: 'New project',
createDesc: 'Name a workspace and add one or more folders.',
diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.ts
index 92e13cc5f5d..b9e3d070254 100644
--- a/apps/desktop/src/i18n/ja.ts
+++ b/apps/desktop/src/i18n/ja.ts
@@ -2088,6 +2088,7 @@ export const ja = defineLocale({
projects: {
sectionLabel: 'プロジェクト',
home: 'ホーム',
+ autoDiscovered: '自動検出',
newButton: '新規プロジェクト',
createTitle: '新規プロジェクト',
createDesc: 'ワークスペースに名前を付け、1つ以上のフォルダを追加します。',
diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.ts
index 9f427d5a717..e28864319fe 100644
--- a/apps/desktop/src/i18n/types.ts
+++ b/apps/desktop/src/i18n/types.ts
@@ -2080,6 +2080,7 @@ export interface Translations {
projects: {
sectionLabel: string
home: string
+ autoDiscovered: string
newButton: string
createTitle: string
createDesc: string
diff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.ts
index 5376fdc77b1..43ee5999e7a 100644
--- a/apps/desktop/src/i18n/zh-hant.ts
+++ b/apps/desktop/src/i18n/zh-hant.ts
@@ -2012,6 +2012,7 @@ export const zhHant = defineLocale({
projects: {
sectionLabel: '專案',
home: '主頁',
+ autoDiscovered: '自動探索',
newButton: '新增專案',
createTitle: '新增專案',
createDesc: '為工作區命名並新增一個或多個資料夾。',
diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.ts
index c82b2da9e3d..9c70476e620 100644
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@ -2603,6 +2603,7 @@ export const zh: Translations = {
projects: {
sectionLabel: '项目',
home: '主页',
+ autoDiscovered: '自动发现',
newButton: '新建项目',
createTitle: '新建项目',
createDesc: '为工作区命名并添加一个或多个文件夹。',