diff --git a/.playwright/scripts/__tests__/feature-discovery.e2e.mjs b/.playwright/scripts/__tests__/feature-discovery.e2e.mjs index 5541df863..6cf442cbd 100644 --- a/.playwright/scripts/__tests__/feature-discovery.e2e.mjs +++ b/.playwright/scripts/__tests__/feature-discovery.e2e.mjs @@ -8,13 +8,14 @@ const { parse } = createRequire(new URL('../../../apps/buddy/package.json', impo async function launchRelease(instance, version = '0.14.0') { const initial = parse(await fs.readFile(path.join(instance.home, 'config.toml'), 'utf8')).desktop?.feature_discovery ?? { version: '', pending: [], notified: [] } const launched = await instance.launch() - const currentVersion = await launched.page.evaluate(async () => (await window.lexoraDesktop.app.getInfo()).version) - await expect.poll(() => launched.page.evaluate(async () => (await window.lexoraDesktop.settings.get()).desktop.featureDiscovery.version)).toBe(currentVersion) - await launched.app.evaluate(({ app }, version) => { + const appInfo = await launched.page.evaluate(() => window.lexoraDesktop.app.getInfo()) + await expect.poll(() => launched.page.evaluate(async () => (await window.lexoraDesktop.settings.get()).desktop.featureDiscovery.version)).toBe(appInfo.version) + await launched.app.evaluate(({ app, ipcMain }, info) => { if (app.getName() !== 'Lexora Buddy Test') throw new Error('Release previews require an isolated test instance') - app.getVersion = () => version - }, version) + ipcMain.removeHandler('lexora:app:get-info') + ipcMain.handle('lexora:app:get-info', () => info) + }, { ...appInfo, version }) await launched.page.evaluate(featureDiscovery => window.lexoraDesktop.settings.update({ desktop: { featureDiscovery } }), initial) await launched.page.reload() return launched @@ -34,6 +35,54 @@ async function readProfile(page) { }) } +test('0.22.0 lists only archive and Chinese input triggers with working tour destinations', async ({ buddy }, testInfo) => { + const instance = await buddy.createInstance('feature-guides-022') + await fs.writeFile(path.join(instance.home, 'config.toml'), '[desktop]\nlanguage="zh-CN"\nfeature_announcements_enabled=false\n[desktop.feature_discovery]\nversion="0.21.0"\npending=[]\nnotified=[]\n[pet]\nenabled=false\n') + const { page } = await launchRelease(instance, '0.22.0') + const discovery = () => page.evaluate(async () => (await window.lexoraDesktop.settings.get()).desktop.featureDiscovery) + await expect.poll(discovery).toMatchObject({ pending: ['task-archive', 'chinese-input-triggers'] }) + await openFeatures(page) + const dialog = page.locator('.feature-discovery-dialog') + await expect(dialog.getByRole('heading', { name: 'v0.22.0', exact: true })).toBeVisible() + await expect(dialog.locator('article h3')).toHaveText(['任务归档', '中文输入法触发符']) + await page.screenshot({ path: testInfo.outputPath('release-features-022.png'), animations: 'disabled' }) + await dialog.getByRole('button', { name: '定位功能:任务归档', exact: true }).click() + const hint = page.locator('.buddy-feature-popover') + await expect(page.locator('.desktop-settings-page__title')).toHaveText('任务归档') + await expect(hint).toHaveAttribute('data-step', 'task-archive') + await expect(hint).toContainText('1 / 2') + await expect.poll(discovery).toMatchObject({ pending: ['task-archive', 'chinese-input-triggers'] }) + await page.screenshot({ path: testInfo.outputPath('01-task-archive-title-guide.png'), animations: 'disabled' }) + await hint.getByRole('button', { name: '下一步', exact: true }).click() + await expect(hint).toHaveAttribute('data-step', 'task-archive-cleanup') + await expect(hint).toContainText('2 / 2') + await expect(page.locator('#archive-cleanup-policy')).toContainText('不清理') + await expect.poll(discovery).toMatchObject({ pending: ['chinese-input-triggers'] }) + await page.screenshot({ path: testInfo.outputPath('02-task-archive-cleanup-guide.png'), animations: 'disabled' }) + await hint.getByRole('button', { name: '完成引导', exact: true }).click() + await openFeatures(page) + await dialog.getByRole('button', { name: '定位功能:中文输入法触发符', exact: true }).click() + await expect(hint).toHaveAttribute('data-step', 'chinese-input-triggers') + await expect(page.getByTestId('chinese-input-triggers-setting').getByRole('switch')).toBeVisible() + await expect(hint).toContainText('¥') + await expect.poll(discovery).toMatchObject({ pending: [] }) + await page.screenshot({ path: testInfo.outputPath('03-chinese-input-triggers-setting-guide.png'), animations: 'disabled' }) + await hint.getByRole('button', { name: '知道了', exact: true }).click() + await expect(hint).toHaveCount(0) + await openFeatures(page) + await dialog.getByRole('button', { name: '逐项了解', exact: true }).click() + await expect(hint).toHaveAttribute('data-step', 'task-archive') + await expect(hint).toContainText('1 / 3') + await hint.getByRole('button', { name: '下一步', exact: true }).click() + await expect(hint).toHaveAttribute('data-step', 'task-archive-cleanup') + await expect(hint).toContainText('2 / 3') + await hint.getByRole('button', { name: '下一步', exact: true }).click() + await expect(hint).toHaveAttribute('data-step', 'chinese-input-triggers') + await expect(hint).toContainText('3 / 3') + await hint.getByRole('button', { name: '完成引导', exact: true }).click() + await expect(hint).toHaveCount(0) +}) + test('dismissed reminders and viewed features survive restart while individual guides leave controls usable', async ({ buddy }) => { const instance = await buddy.createInstance('feature-guides') await fs.writeFile(path.join(instance.home, 'config.toml'), '[desktop]\nlanguage="zh-CN"\n[desktop.feature_discovery]\nversion="0.12.0"\npending=[]\nnotified=[]\n[pet]\nenabled=false\n') diff --git a/apps/buddy/shared/onboarding/__tests__/featureDiscovery.spec.ts b/apps/buddy/shared/onboarding/__tests__/featureDiscovery.spec.ts index dce1648e6..db4e92ac6 100644 --- a/apps/buddy/shared/onboarding/__tests__/featureDiscovery.spec.ts +++ b/apps/buddy/shared/onboarding/__tests__/featureDiscovery.spec.ts @@ -8,6 +8,17 @@ const features = [ ] describe('feature discovery across releases', () => { + it('introduces archive and Chinese input triggers only in 0.22.0 while preserving previous progress', () => { + const ids = ['task-archive', 'chinese-input-triggers'] + expect(availableFeatureGuides('0.21.0').filter(feature => ids.includes(feature.id))).toEqual([]) + expect(availableFeatureGuides('0.22.0').filter(feature => feature.version === '0.22.0').map(feature => feature.id)).toEqual(ids) + expect(advanceFeatureDiscovery({ version: '0.21.0', pending: ['npc-team'], notified: ['npc-team'] }, '0.22.0', false)).toEqual({ + version: '0.22.0', + pending: ['npc-team', ...ids], + notified: ['npc-team'], + }) + }) + it('introduces the new runtime and model settings when upgrading to 0.18.0', () => { const ids = ['follow-up-behavior', 'speech-settings', 'image-settings', 'codemode-concurrency'] expect(availableFeatureGuides('0.17.0').filter(feature => ids.includes(feature.id))).toEqual([]) diff --git a/apps/buddy/shared/onboarding/featureDiscovery.ts b/apps/buddy/shared/onboarding/featureDiscovery.ts index 7e42ee9af..6a2265a58 100644 --- a/apps/buddy/shared/onboarding/featureDiscovery.ts +++ b/apps/buddy/shared/onboarding/featureDiscovery.ts @@ -10,6 +10,8 @@ export const FEATURE_GUIDES = [ { id: 'speech-settings', version: '0.18.0' }, { id: 'image-settings', version: '0.18.0' }, { id: 'codemode-concurrency', version: '0.18.0' }, + { id: 'task-archive', version: '0.22.0' }, + { id: 'chinese-input-triggers', version: '0.22.0' }, ] as const export type FeatureGuideId = typeof FEATURE_GUIDES[number]['id'] diff --git a/apps/buddy/src/app/bootstrap/DesktopAppProvider.vue b/apps/buddy/src/app/bootstrap/DesktopAppProvider.vue index 4ebbab4a2..5d8507bf7 100644 --- a/apps/buddy/src/app/bootstrap/DesktopAppProvider.vue +++ b/apps/buddy/src/app/bootstrap/DesktopAppProvider.vue @@ -335,6 +335,8 @@ const featureDiscovery = useFeatureDiscovery({ 'codemode-concurrency': desktopRouteLocations.settings('runtime'), 'speech-settings': desktopRouteLocations.settings('speech'), 'image-settings': desktopRouteLocations.settings('models'), + 'task-archive': desktopRouteLocations.settings('task-archive'), + 'chinese-input-triggers': desktopRouteLocations.settings('general'), }[id] await navigation.navigate(location) if (router.currentRoute.value.path !== router.resolve(location).path) diff --git a/apps/buddy/src/i18n/locales/en-US/discovery.ts b/apps/buddy/src/i18n/locales/en-US/discovery.ts index a956e8d41..d6579e1b1 100644 --- a/apps/buddy/src/i18n/locales/en-US/discovery.ts +++ b/apps/buddy/src/i18n/locales/en-US/discovery.ts @@ -1,4 +1,12 @@ export default { + 'discovery.task-archive.title': 'Task archive', + 'discovery.task-archive.description': 'Archive tasks you do not currently need to keep your task list tidy. Find, restore, or permanently delete archived tasks in Settings → Personal → Task archive.', + 'discovery.task-archive.hint': 'Choose “Archive” from a task menu, then search by title, filter by Space, or restore tasks here. Manual deletion asks for confirmation and cannot be undone.', + 'discovery.task-archive-cleanup.title': 'Automatic archive cleanup', + 'discovery.task-archive-cleanup.hint': 'Automatic cleanup is off by default. You can keep tasks for 3, 7, or 30 days after archiving. Expired archived tasks are permanently deleted; enabling cleanup or shortening retention requires confirmation.', + 'discovery.chinese-input-triggers.title': 'Chinese input method triggers', + 'discovery.chinese-input-triggers.description': 'Use “、” for slash commands and “¥” for skills without switching to English input. The original “/” and “$” triggers still work.', + 'discovery.chinese-input-triggers.hint': 'Turn this switch on to use “、” for slash commands and “¥” for skill suggestions in task inputs. Text stays unchanged unless you select a suggestion. The “/” and “$” triggers still work when this is off.', 'discovery.codemode-concurrency.title': 'Choose tool orchestration concurrency', 'discovery.codemode-concurrency.description': 'Set script concurrency for all tasks in Runtime settings: 8 by default, a custom count, or unlimited. Choose to wait or return busy when capacity is full.', 'discovery.codemode-concurrency.hint': 'Raise concurrency to run more scripts at once. Unlimited asks you to acknowledge resource usage. Waiting scripts resume as capacity becomes available.', diff --git a/apps/buddy/src/i18n/locales/zh-CN/discovery.ts b/apps/buddy/src/i18n/locales/zh-CN/discovery.ts index fc3b1fb1d..f867e195d 100644 --- a/apps/buddy/src/i18n/locales/zh-CN/discovery.ts +++ b/apps/buddy/src/i18n/locales/zh-CN/discovery.ts @@ -1,4 +1,12 @@ export default { + 'discovery.task-archive.title': '任务归档', + 'discovery.task-archive.description': '将暂时不需要的任务归档,让任务列表更清爽。在“设置 → 个人 → 任务归档”中查找、恢复或永久删除归档任务。', + 'discovery.task-archive.hint': '从任务菜单选择“归档”,之后可在这里按标题搜索、按空间筛选并恢复任务。手动删除归档任务时会要求确认,删除后不可恢复。', + 'discovery.task-archive-cleanup.title': '自动清理归档任务', + 'discovery.task-archive-cleanup.hint': '默认不自动清理,也可选择归档后保留 3、7 或 30 天。超过保留期的归档任务会被永久删除;启用或缩短保留期前需要确认。', + 'discovery.chinese-input-triggers.title': '中文输入法触发符', + 'discovery.chinese-input-triggers.description': '无需切换英文输入:在输入框中使用“、”触发斜杠命令,使用“¥”触发技能。原有“/”和“$”仍可使用。', + 'discovery.chinese-input-triggers.hint': '打开此开关后,可在任务输入框中使用“、”触发斜杠命令、使用“¥”触发技能建议。未选择建议时保留原文;关闭后仍可使用“/”和“$”。', 'discovery.codemode-concurrency.title': '按需调整工具编排并发', 'discovery.codemode-concurrency.description': '在运行时设置中调整所有任务共享的脚本并发数量,默认 8 个,也可选择不限制。容量满时可排队等待或返回繁忙。', 'discovery.codemode-concurrency.hint': '提高并发数可让更多脚本同时工作。选择不限制前会提醒资源占用风险;排队中的脚本会在空位释放后继续。', diff --git a/apps/buddy/src/modules/onboarding/model/featureGuideSteps.ts b/apps/buddy/src/modules/onboarding/model/featureGuideSteps.ts index 3527b43da..0baeb8ea7 100644 --- a/apps/buddy/src/modules/onboarding/model/featureGuideSteps.ts +++ b/apps/buddy/src/modules/onboarding/model/featureGuideSteps.ts @@ -3,6 +3,13 @@ import type { FeatureGuideId } from '@buddy-shared/onboarding/featureDiscovery' const inlineBeacon = { side: 'right', align: 'center', offsetX: 12 } as const const targets = { + 'task-archive': [ + { id: 'task-archive', selector: '.desktop-settings-page:has([data-testid="task-archive-manager"]) .desktop-settings-page__title', title: 'discovery.task-archive.title', description: 'discovery.task-archive.hint', beacon: inlineBeacon, side: 'bottom', align: 'start' }, + { id: 'task-archive-cleanup', selector: '#archive-cleanup-policy', title: 'discovery.task-archive-cleanup.title', description: 'discovery.task-archive-cleanup.hint', beacon: { side: 'left', align: 'center', offsetX: -12 }, side: 'bottom', align: 'end' }, + ], + 'chinese-input-triggers': [ + { id: 'chinese-input-triggers', selector: '[data-testid="chinese-input-triggers-setting"] [role="switch"]', title: 'discovery.chinese-input-triggers.title', description: 'discovery.chinese-input-triggers.hint', beacon: { side: 'left', align: 'center', offsetX: -12 }, side: 'left', align: 'center' }, + ], 'codemode-concurrency': [ { id: 'codemode-concurrency', selector: '[data-testid="codemode-concurrency-setting"] .desktop-segmented-control', title: 'discovery.codemode-concurrency.title', description: 'discovery.codemode-concurrency.hint', beacon: inlineBeacon, side: 'bottom', align: 'start' }, ],