From d090550a26f0c3e87692f8c93ae7bd4d31e7f286 Mon Sep 17 00:00:00 2001 From: axb Date: Tue, 18 Aug 2026 21:16:24 +0800 Subject: [PATCH 1/5] fix(wework): expose project creation in empty sidebar --- docs/en/wework/projects.md | 2 ++ docs/zh/wework/projects.md | 2 ++ wework/e2e/desktop/modules/shared.mjs | 13 +++++++++- .../components/layout/DesktopSidebar.test.tsx | 24 +++++++++++++++++++ .../src/components/layout/DesktopSidebar.tsx | 12 +++++++++- 5 files changed, 51 insertions(+), 2 deletions(-) diff --git a/docs/en/wework/projects.md b/docs/en/wework/projects.md index ed8a35553c0..7b7af12260f 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 on first use, 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 4c380b66715..8cfa6c0417c 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/wework/e2e/desktop/modules/shared.mjs b/wework/e2e/desktop/modules/shared.mjs index 9f05d8703f2..0653f9bbaee 100644 --- a/wework/e2e/desktop/modules/shared.mjs +++ b/wework/e2e/desktop/modules/shared.mjs @@ -1289,7 +1289,18 @@ async function confirmLocalProjectName(control, name) { } async function createSingleRootLocalProject(control, workspacePath, name) { - await control.command('click', '[data-testid="projects-create-button"]') + const sidebarSnapshot = JSON.parse(await control.command('snapshot', 'body')) + 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 832bbd9de49..0b18c4e868f 100644 --- a/wework/src/components/layout/DesktopSidebar.test.tsx +++ b/wework/src/components/layout/DesktopSidebar.test.tsx @@ -223,6 +223,30 @@ 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 } }) + + 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('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 4cd34de4b19..6aaad518464 100644 --- a/wework/src/components/layout/DesktopSidebar.tsx +++ b/wework/src/components/layout/DesktopSidebar.tsx @@ -3563,6 +3563,8 @@ export function DesktopSidebar({ ) }, [currentRuntimeTask, regularChatTaskItems]) const displayedProjectsExpanded = projectsExpanded + const showEmptyProjectCreateAction = + sidebarProjects.length === 0 && cloudWorkStatus?.checks.runtimeWork !== 'syncing' const displayedChatsExpanded = chatsExpanded || selectedRuntimeChatVisible || @@ -4301,7 +4303,15 @@ export function DesktopSidebar({ , document.body )} - {displayedProjectsExpanded && ( + {displayedProjectsExpanded && showEmptyProjectCreateAction && ( + + )} + {displayedProjectsExpanded && sidebarProjects.length > 0 && ( Date: Tue, 18 Aug 2026 21:38:19 +0800 Subject: [PATCH 2/5] fix(wework): wait for project sidebar readiness --- docs/en/wework/projects.md | 2 +- docs/zh/wework/projects.md | 2 +- wework/e2e/desktop/modules/shared.mjs | 8 ++++++- .../components/layout/DesktopSidebar.test.tsx | 22 ++++++++++++++++++- .../src/components/layout/DesktopSidebar.tsx | 8 ++++++- 5 files changed, 37 insertions(+), 5 deletions(-) diff --git a/docs/en/wework/projects.md b/docs/en/wework/projects.md index 7b7af12260f..42d422481fa 100644 --- a/docs/en/wework/projects.md +++ b/docs/en/wework/projects.md @@ -8,7 +8,7 @@ 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 on first use, 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. +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. diff --git a/docs/zh/wework/projects.md b/docs/zh/wework/projects.md index 8cfa6c0417c..f8cc7e0fa97 100644 --- a/docs/zh/wework/projects.md +++ b/docs/zh/wework/projects.md @@ -8,7 +8,7 @@ sidebar_position: 3 ## 使用现有目录 -首次使用且项目列表为空时,左侧栏的 **项目** 分组会直接显示 **+ 新建项目**。点击后选择 **本地项目** 或 **云端项目**;云端项目仍需先连接云端。项目数据同步期间不会显示这个空状态入口,避免把尚未加载完成误判为没有项目。 +项目列表为空时,左侧栏的 **项目** 分组会直接显示 **+ 新建项目**。点击后选择 **本地项目** 或 **云端项目**;云端项目仍需先连接云端。项目数据同步期间不会显示这个空状态入口,避免把尚未加载完成误判为没有项目。 本机项目选择 **使用现有目录** 后,Wework 会打开系统目录选择器。再次添加同一目录时,Wework 会复用已有项目;如果项目曾被移除,则会恢复项目及其历史会话。 diff --git a/wework/e2e/desktop/modules/shared.mjs b/wework/e2e/desktop/modules/shared.mjs index 0653f9bbaee..1fc886bd42d 100644 --- a/wework/e2e/desktop/modules/shared.mjs +++ b/wework/e2e/desktop/modules/shared.mjs @@ -1289,7 +1289,13 @@ async function confirmLocalProjectName(control, name) { } async function createSingleRootLocalProject(control, workspacePath, name) { - const sidebarSnapshot = JSON.parse(await control.command('snapshot', 'body')) + 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"]' diff --git a/wework/src/components/layout/DesktopSidebar.test.tsx b/wework/src/components/layout/DesktopSidebar.test.tsx index 0b18c4e868f..a74b3f9fc61 100644 --- a/wework/src/components/layout/DesktopSidebar.test.tsx +++ b/wework/src/components/layout/DesktopSidebar.test.tsx @@ -224,7 +224,14 @@ describe('DesktopSidebar', () => { }) test('shows a discoverable project creation action when the project list is empty', async () => { - renderSidebar({ projects: [], runtimeWork: { projects: [], chats: [], totalTasks: 0 } }) + 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('新建项目') @@ -247,6 +254,19 @@ describe('DesktopSidebar', () => { 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 6aaad518464..db3f3f46170 100644 --- a/wework/src/components/layout/DesktopSidebar.tsx +++ b/wework/src/components/layout/DesktopSidebar.tsx @@ -3563,8 +3563,14 @@ export function DesktopSidebar({ ) }, [currentRuntimeTask, regularChatTaskItems]) const displayedProjectsExpanded = projectsExpanded + const runtimeWorkCheck = cloudWorkStatus?.checks.runtimeWork const showEmptyProjectCreateAction = - sidebarProjects.length === 0 && cloudWorkStatus?.checks.runtimeWork !== 'syncing' + runtimeWork !== null && + runtimeWork !== undefined && + runtimeWorkCheck !== null && + runtimeWorkCheck !== undefined && + runtimeWorkCheck !== 'syncing' && + sidebarProjects.length === 0 const displayedChatsExpanded = chatsExpanded || selectedRuntimeChatVisible || From 6faf2bf54e3e15df26e790a479ab7a57f28e3bf9 Mon Sep 17 00:00:00 2001 From: axb Date: Wed, 19 Aug 2026 16:24:47 +0800 Subject: [PATCH 3/5] fix(hooks): avoid Alembic check pipe deadlock --- scripts/hooks/check-alembic-heads.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/hooks/check-alembic-heads.sh b/scripts/hooks/check-alembic-heads.sh index 2c0fe01544c..9e140e864c2 100755 --- a/scripts/hooks/check-alembic-heads.sh +++ b/scripts/hooks/check-alembic-heads.sh @@ -175,12 +175,14 @@ echo "" # Find all heads (revisions not referenced by any down_revision) HEADS="" -while IFS= read -r rev; do +# Iterate words directly so a large revision list cannot fill a here-doc pipe +# before the loop starts reading it. +for rev in $ALL_REVISIONS; do [ -z "$rev" ] && continue if ! key_exists "$IS_REFERENCED" "$rev"; then HEADS="${HEADS}${rev}"$'\n' fi -done <<< "$ALL_REVISIONS" +done # Count heads (remove empty lines) HEAD_COUNT=$(echo "$HEADS" | grep -c .) @@ -193,10 +195,10 @@ HEAD_COUNT=$(echo "$HEADS" | grep -c .) NON_STANDARD_COUNT=$(echo "$NON_STANDARD_IDS" | grep -c . || true) if [ "$NON_STANDARD_COUNT" -gt 0 ]; then echo -e "${YELLOW}⚠️ Non-standard revision ID format detected:${NC}" - while IFS= read -r id; do + printf '%s' "$NON_STANDARD_IDS" | while IFS= read -r id; do [ -z "$id" ] && continue echo -e " ${YELLOW}• $id${NC}" - done <<< "$NON_STANDARD_IDS" + done echo "" echo -e "${YELLOW} Recommendation: Use 'alembic revision --autogenerate' to generate${NC}" echo -e "${YELLOW} standard 12-character hexadecimal revision IDs.${NC}" @@ -219,11 +221,11 @@ 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})" - done <<< "$HEADS" + done echo "" # Provide fix instructions From a29cdf09afef16ac6943be27176bec78c913b45d Mon Sep 17 00:00:00 2001 From: axb Date: Wed, 19 Aug 2026 19:02:45 +0800 Subject: [PATCH 4/5] test(wework): mock embedded browser zoom --- .../layout/workspace-panels/WorkspaceBrowserPanel.test.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/wework/src/components/layout/workspace-panels/WorkspaceBrowserPanel.test.tsx b/wework/src/components/layout/workspace-panels/WorkspaceBrowserPanel.test.tsx index d8990f7cd37..8003bd6907e 100644 --- a/wework/src/components/layout/workspace-panels/WorkspaceBrowserPanel.test.tsx +++ b/wework/src/components/layout/workspace-panels/WorkspaceBrowserPanel.test.tsx @@ -50,6 +50,7 @@ const embeddedBrowserMocks = vi.hoisted(() => ({ 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', })) From 7c8f90938997ff6c84376326eeff2a063dcc06e9 Mon Sep 17 00:00:00 2001 From: axb Date: Wed, 19 Aug 2026 20:41:40 +0800 Subject: [PATCH 5/5] test(wework): resolve embedded browser zoom mock --- .../layout/workspace-panels/WorkspaceBrowserPanel.test.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/wework/src/components/layout/workspace-panels/WorkspaceBrowserPanel.test.tsx b/wework/src/components/layout/workspace-panels/WorkspaceBrowserPanel.test.tsx index 8003bd6907e..971a33d695a 100644 --- a/wework/src/components/layout/workspace-panels/WorkspaceBrowserPanel.test.tsx +++ b/wework/src/components/layout/workspace-panels/WorkspaceBrowserPanel.test.tsx @@ -185,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', () => {