diff --git a/docs/en/wework/projects.md b/docs/en/wework/projects.md index 1adf05a00da..616335092bf 100644 --- a/docs/en/wework/projects.md +++ b/docs/en/wework/projects.md @@ -8,6 +8,8 @@ Projects group conversations that use the same codebase. A project can map to fo ## Existing folders and Git projects +When the project list is empty, the sidebar's **Projects** section shows **+ New project** directly. Select it to choose a **Local project** or **Cloud project**; cloud projects still require a cloud connection. Wework hides this empty-state action while project data is synchronizing so an unfinished load is not mistaken for an empty list. + Choose **Use existing folder** for code already on the device. Adding the same folder again restores or reuses its project and conversations. In local mode, choose **Local project** and select one or more folders in the system directory picker. This entry always uses the local execution device, even when cloud or remote devices are connected; use **Cloud project** to select a folder on another device. The create-project dialog uses the first source folder's name as the project name by default; you can edit the name or add and remove source folders before confirming. Wework saves the folders as one Codex project and uses the first folder as its default workspace. The project list keeps one project row instead of expanding every source folder. Use **Edit project** from the project menu to rename the project, add or remove source folders, or change the primary folder. Multi-folder creation currently applies only to local Codex projects; cloud and remote projects are still added one folder at a time. diff --git a/docs/zh/wework/projects.md b/docs/zh/wework/projects.md index 52402e7277d..3ab6778fce0 100644 --- a/docs/zh/wework/projects.md +++ b/docs/zh/wework/projects.md @@ -8,6 +8,8 @@ sidebar_position: 3 ## 使用现有目录 +项目列表为空时,左侧栏的 **项目** 分组会直接显示 **+ 新建项目**。点击后选择 **本地项目** 或 **云端项目**;云端项目仍需先连接云端。项目数据同步期间不会显示这个空状态入口,避免把尚未加载完成误判为没有项目。 + 本机项目选择 **使用现有目录** 后,Wework 会打开系统目录选择器。再次添加同一目录时,Wework 会复用已有项目;如果项目曾被移除,则会恢复项目及其历史会话。 在本地模式中,点击 **本地项目** 后,可以在系统目录选择器里同时选择多个目录。该入口始终使用本机执行设备,即使当前还连接了云设备或远程设备;如需选择其他设备上的目录,请使用 **云端项目**。选完目录后,创建项目弹窗会默认使用第一个源目录的文件夹名作为项目名称,你也可以修改名称或继续添加、移除源目录;确认后,Wework 会把这些目录保存为同一个 Codex 项目,并使用第一个目录作为项目列表和新任务的默认工作区。项目列表只显示一条项目记录,不会展开全部源目录。通过项目菜单中的 **编辑项目** 可以重命名项目、添加或移除源目录,以及调整主目录。该能力目前仅支持本机 Codex 项目,云端和远程项目仍按单目录添加。 diff --git a/scripts/hooks/check-alembic-heads.sh b/scripts/hooks/check-alembic-heads.sh index f105e310874..af68a953868 100755 --- a/scripts/hooks/check-alembic-heads.sh +++ b/scripts/hooks/check-alembic-heads.sh @@ -219,7 +219,7 @@ else echo -e "${RED}❌ Alembic Multi-Head Check: FAILED${NC}" echo "" echo -e "${RED}${BOLD} Multiple heads detected (${HEAD_COUNT}):${NC}" - while IFS= read -r head; do + for head in $HEADS; do [ -z "$head" ] && continue head_file=$(get_value "$REVISIONS" "$head") echo -e " ${RED}• ${head}${NC} (${head_file})" diff --git a/wework/e2e/desktop/modules/shared.mjs b/wework/e2e/desktop/modules/shared.mjs index 16a31a9ae35..1d55ecd62f3 100644 --- a/wework/e2e/desktop/modules/shared.mjs +++ b/wework/e2e/desktop/modules/shared.mjs @@ -1289,7 +1289,24 @@ async function confirmLocalProjectName(control, name) { } async function createSingleRootLocalProject(control, workspacePath, name) { - await control.command('click', '[data-testid="projects-create-button"]') + const sidebarSnapshot = await waitForSnapshot( + control, + snapshot => + snapshot.testIds.includes('projects-empty-create-button') || + snapshot.testIds.includes('runtime-project-sortable-list'), + 'The project section did not settle into an empty or populated state' + ) + const createButtonSelector = sidebarSnapshot.testIds.includes('projects-empty-create-button') + ? '[data-testid="projects-empty-create-button"]' + : '[data-testid="projects-create-button"]' + if (createButtonSelector.includes('projects-empty-create-button')) { + assert.match( + await control.command('getText', createButtonSelector), + /New project|新建项目/, + 'The empty project section did not expose a localized creation action' + ) + } + await control.command('click', createButtonSelector) await control.command('click', '[data-testid="project-create-local-option"]') await control.command('waitFor', '[data-testid="device-folder-path-input"]', { timeoutMs: DEFAULT_STEP_TIMEOUT_MS, diff --git a/wework/src/components/layout/DesktopSidebar.test.tsx b/wework/src/components/layout/DesktopSidebar.test.tsx index 6bf92168992..833e1d64bde 100644 --- a/wework/src/components/layout/DesktopSidebar.test.tsx +++ b/wework/src/components/layout/DesktopSidebar.test.tsx @@ -229,6 +229,50 @@ describe('DesktopSidebar', () => { expect(screen.getByTestId('projects-create-button')).toBeInTheDocument() }) + test('shows a discoverable project creation action when the project list is empty', async () => { + renderSidebar({ + projects: [], + runtimeWork: { projects: [], chats: [], totalTasks: 0 }, + cloudWorkStatus: cloudWorkStatus({ + availability: 'empty', + checks: { runtimeWork: 'empty' }, + }), + }) + + const createButton = screen.getByTestId('projects-empty-create-button') + expect(createButton).toHaveTextContent('新建项目') + + await userEvent.click(createButton) + + expect(screen.getByTestId('projects-create-button-menu')).toBeInTheDocument() + }) + + test('does not show the empty project creation action while projects are syncing', () => { + renderSidebar({ + projects: [], + runtimeWork: { projects: [], chats: [], totalTasks: 0 }, + cloudWorkStatus: cloudWorkStatus({ + availability: 'syncing', + checks: { runtimeWork: 'syncing' }, + }), + }) + + expect(screen.queryByTestId('projects-empty-create-button')).not.toBeInTheDocument() + }) + + test('does not show the empty project creation action before runtime work loads', () => { + renderSidebar({ + projects: [], + runtimeWork: null, + cloudWorkStatus: cloudWorkStatus({ + availability: 'idle', + checks: { runtimeWork: 'idle' }, + }), + }) + + expect(screen.queryByTestId('projects-empty-create-button')).not.toBeInTheDocument() + }) + test('keeps the sidebar color stable across browser focus changes', () => { Reflect.deleteProperty(window, '__TAURI_INTERNALS__') renderSidebar() diff --git a/wework/src/components/layout/DesktopSidebar.tsx b/wework/src/components/layout/DesktopSidebar.tsx index 7eb7486fd20..c76cf70fef3 100644 --- a/wework/src/components/layout/DesktopSidebar.tsx +++ b/wework/src/components/layout/DesktopSidebar.tsx @@ -3606,6 +3606,14 @@ export function DesktopSidebar({ ) }, [currentRuntimeTask, regularChatTaskItems]) const displayedProjectsExpanded = projectsExpanded + const runtimeWorkCheck = cloudWorkStatus?.checks.runtimeWork + const showEmptyProjectCreateAction = + runtimeWork !== null && + runtimeWork !== undefined && + runtimeWorkCheck !== null && + runtimeWorkCheck !== undefined && + runtimeWorkCheck !== 'syncing' && + sidebarProjects.length === 0 const displayedChatsExpanded = chatsExpanded || selectedRuntimeChatVisible || @@ -4344,7 +4352,15 @@ export function DesktopSidebar({ , document.body )} - {displayedProjectsExpanded && ( + {displayedProjectsExpanded && showEmptyProjectCreateAction && ( + + )} + {displayedProjectsExpanded && sidebarProjects.length > 0 && ( ({ setEmbeddedBrowserAgentControlPaused: vi.fn(), setEmbeddedBrowserActiveTab: vi.fn(), setEmbeddedBrowserBounds: vi.fn(), + setEmbeddedBrowserZoom: vi.fn(), EMBEDDED_BROWSER_DEBUG_PANEL_VISIBILITY_EVENT: 'wework:debug-panel-visibility-change', EMBEDDED_BROWSER_OCCLUSION_EVENT: 'wework:embedded-browser-occlusion-change', })) @@ -184,6 +185,7 @@ describe('WorkspaceBrowserPanel', () => { embeddedBrowserMocks.resolveEmbeddedBrowserAgentApproval.mockResolvedValue(undefined) embeddedBrowserMocks.setEmbeddedBrowserAgentControlPaused.mockResolvedValue(undefined) embeddedBrowserMocks.setEmbeddedBrowserBounds.mockResolvedValue(undefined) + embeddedBrowserMocks.setEmbeddedBrowserZoom.mockResolvedValue(undefined) }) test('disables text correction in the browser address bar', () => {