From 9317d0acc7cfa6eab2379ab37acefbac8e435fad Mon Sep 17 00:00:00 2001 From: brother7 <7brother7@gmail.com> Date: Mon, 14 Sep 2026 14:11:39 +0800 Subject: [PATCH] ui: show Agents first in module chooser --- .../20260914-agents-entry-art-0242f8f3.md | 4 ++++ src/lib/ai-modules.ts | 20 +++++++++---------- tests/e2e/main-navigation.spec.ts | 4 ++++ tests/unit/module-navigation.test.tsx | 7 ++++++- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/.project-docs/30-worklog/tasks/20260914-agents-entry-art-0242f8f3.md b/.project-docs/30-worklog/tasks/20260914-agents-entry-art-0242f8f3.md index 8f2389b..15d4bd8 100644 --- a/.project-docs/30-worklog/tasks/20260914-agents-entry-art-0242f8f3.md +++ b/.project-docs/30-worklog/tasks/20260914-agents-entry-art-0242f8f3.md @@ -14,11 +14,13 @@ - Replace the Agents module chooser placeholder with a generated cinematic illustration in `src/assets/module-agents.webp`. - Follow-up: replace the Agents description in `src/lib/ai-modules.ts` with the user's corrected exact slogan `打造你想象中的AI助手`. +- Ordering follow-up: place Agents first in the module catalog; remaining visual/DOM order is Code, Canvas, Robot. Preserve ID-based navigation and the new artwork/slogan. - Reuse the existing module image container, center crop, accessibility text, disabled grayscale and navigation. Require artwork for all four module entries and remove the now-unused placeholder branch. - Update existing module navigation unit/Electron coverage and this task record only. ## Intent And Constraints +- Same-task ordering follow-up: official check/start/status passed in this clean worktree; reused already loaded project/peer context and confirmed module catalog consumers. Planning Gate Passed. Only chooser ordering changes; `getAiModuleForPath` still returns the same IDs and default Code route. Extend the existing UI order assertions and rerun the existing Electron layout test to verify the now-first Agents card at both window sizes. - Same-task slogan follow-up: official check/start/status passed and reused this clean feature worktree and the already loaded project/peer context. Planning Gate Passed. User corrected `想像` to `想象`; use the corrected text verbatim, without extra spaces or quotation marks in the UI. This is a copy-only change; existing tests are sufficient and no new interaction test is needed. - Concurrent Task Gate and Planning Gate passed. Official start exited 0 and status matched the task ID, feature mode, branch, absolute worktree and base above. All subsequent operations use this isolated worktree; primary `main` has other ownership and three pre-existing untracked task records. - Loaded the planning entry, own task, memory index, integrated current state, positioning, decision index, architecture, relevant domain/success criteria, accepted personal-cloud-Agent ADR, README and peer scope/intent/promotion sections. Registry holds 28 other planning tasks and 162 ready tasks; historical placeholder scopes remain unknown coordination state. The recent WeChat diagnosis is read-only, and prior Agents entry/platform work is integrated. No concrete semantic dependency on this artwork was identified. @@ -28,6 +30,7 @@ ## Outcome +- Ordering follow-up completed: final chooser order is Agents, Code, Canvas, Robot in both DOM and visual layout. Real Electron screenshot confirms the first card uses the generated Agent image and `打造你想象中的AI助手`. Module routes remain ID-based and unchanged. - Slogan follow-up completed: the Agents entry description and its accessible button label now use `打造你想象中的AI助手`, matching the user's spelling correction. Existing generated artwork is retained. - Generated and connected the blue/violet holographic Agent artwork. All four entries use the same bundled-image rendering; obsolete violet placeholder markup is removed. Existing card spacing, image crop, labels, policy state and routes are preserved. - Visually inspected the real 1280x800 Electron chooser screenshot: the central figure remains recognizable inside the same 164x132 image region as its neighbors. The existing E2E also verifies the layout after resizing to 1100x700. @@ -35,6 +38,7 @@ ## Verification +- Ordering follow-up: 12/12 module navigation/access unit tests, typecheck, scoped ESLint and all Vite production targets passed. Existing Electron layout test passed 1/1 with explicit four-entry order, first-card slogan, image decode and 1280x800/1100x700 checks. Inspected its refreshed screenshot and full cumulative changes since base; whitespace and task documentation boundary checks passed. - Slogan follow-up: typecheck and all Vite production targets passed; existing module navigation/access tests passed 12/12. Reviewed the single source-string diff; no interaction or layout rule changed. - Frozen install succeeded using the exact pinned pnpm 10.33.4. Generated WebP is 960x540, 90,688 bytes. - `pnpm run typecheck`: passed. diff --git a/src/lib/ai-modules.ts b/src/lib/ai-modules.ts index d4e6363..846a1b5 100644 --- a/src/lib/ai-modules.ts +++ b/src/lib/ai-modules.ts @@ -18,6 +18,16 @@ export type AiModuleDefinition = { }; export const aiModules: readonly AiModuleDefinition[] = [ + { + id: 'cloud_agents', + title: 'Makelore Agents', + subtitle: 'AI 智能体', + description: '打造你想象中的AI助手', + route: '/cloud-agents', + enabled: true, + Icon: Sparkles, + switcherLabel: 'Agents 智能体', + }, { id: 'programming', title: 'Makelore Code', @@ -46,16 +56,6 @@ export const aiModules: readonly AiModuleDefinition[] = [ Icon: Bot, switcherLabel: 'Robot 机器', }, - { - id: 'cloud_agents', - title: 'Makelore Agents', - subtitle: 'AI 智能体', - description: '打造你想象中的AI助手', - route: '/cloud-agents', - enabled: true, - Icon: Sparkles, - switcherLabel: 'Agents 智能体', - }, ]; const moduleAccessKeyById: Record = { diff --git a/tests/e2e/main-navigation.spec.ts b/tests/e2e/main-navigation.spec.ts index 18d777f..7cef580 100644 --- a/tests/e2e/main-navigation.spec.ts +++ b/tests/e2e/main-navigation.spec.ts @@ -89,6 +89,10 @@ test.describe('Makelore module navigation without setup flow', () => { await expect(page.getByTestId('ai-module-selection-page')).toBeVisible(); const moduleCards = page.locator('[data-testid^="ai-module-option-"]'); + await expect(moduleCards.locator('.module-option-card-title')).toHaveText([ + 'Agents 智能体', 'Code 编程', 'Canvas 设计', 'Robot 机器', + ]); + await expect(moduleCards.first().locator('.module-option-card-description')).toHaveText('打造你想象中的AI助手'); await expect(moduleCards.locator('img')).toHaveCount(4); await expect.poll(async () => await moduleCards.locator('img').evaluateAll((images) => images.every((image) => image.complete && image.naturalWidth > 0), diff --git a/tests/unit/module-navigation.test.tsx b/tests/unit/module-navigation.test.tsx index 8850f26..357360d 100644 --- a/tests/unit/module-navigation.test.tsx +++ b/tests/unit/module-navigation.test.tsx @@ -71,7 +71,12 @@ describe('AI module navigation', () => { for (const moduleId of ['programming', 'painting', 'robot', 'cloud_agents'] as const) { expect(screen.getByTestId(`ai-module-option-${moduleId}`).querySelector('.module-option-artwork')).toBeNull(); } - expect(screen.getAllByTestId(/^ai-module-option-/u)).toHaveLength(4); + expect(screen.getAllByTestId(/^ai-module-option-/u).map((option) => option.dataset.testid)).toEqual([ + 'ai-module-option-cloud_agents', + 'ai-module-option-programming', + 'ai-module-option-painting', + 'ai-module-option-robot', + ]); expect(screen.queryByTestId('ai-module-option-learning')).not.toBeInTheDocument(); expect(screen.queryByText('先选一个入口。进入后,你还可以从左下角随时切换到其他模块。')).not.toBeInTheDocument(); expect(screen.queryByText('选择创作空间。你可以随时从侧边栏切换。')).not.toBeInTheDocument();