Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

test(showcase): add reusable bilingual full-client demo fixtures

Dash1640cf7d1f4b
diff --git a/apps/mobile/src/__tests__/visualMock.test.ts b/apps/mobile/src/__tests__/visualMock.test.ts
index 879c492b7f..3bfb38a5bc 100644
--- a/apps/mobile/src/__tests__/visualMock.test.ts
+++ b/apps/mobile/src/__tests__/visualMock.test.ts
@@ -4,6 +4,8 @@ import { getRemoteResource, listRemoteCollection, normalizeRemoteCollectionItems
import { invokePlugin } from '@/plugins/pluginClient';
import { projectHistoryView } from '@cindy/maker-shared/message-window';
import type { RemoteMessage } from '@/session/types';
+import { UI_MOCK_PROJECTS } from '@cindy/maker-shared/ui-mock';
+import type { FileBrowserReadFileResult, FileBrowserListAllFilesResult } from '@/device-link/mobileMakerTransport';
const config = vi.hoisted(() => ({ MOBILE_VISUAL_MOCK_REALDATA_URL: '' }));
vi.mock('@/config/env', () => config);
@@ -14,6 +16,35 @@ vi.mock('@/session/remoteSessionStore', () => ({ remoteSessionStore: {
beforeEach(() => { vi.resetModules(); config.MOBILE_VISUAL_MOCK_REALDATA_URL = ''; });
afterEach(() => { vi.useRealTimers(); vi.unstubAllGlobals(); vi.restoreAllMocks(); vi.clearAllMocks(); });
+it('opens the same showcase folders and files as Desktop through the real mock transport', async () => {
+ const mock = await import('@/debug/visualMock');
+ const link = mock.createVisualMockDeviceLinkContext();
+ const project = UI_MOCK_PROJECTS.find(item => item.name === 'orbit-garden-zh')!;
+ const request = <T>(args: Record<string, unknown>) => link.invoke<T>(mock.VISUAL_MOCK_DEVICE_ID, 'file-browser:remote-op', [{ workdir: `/Users/demo/Projects/${project.name}`, ...args }]);
+ expect(await request({ op: 'listDir', relPath: '' })).toEqual(expect.arrayContaining([
+ expect.objectContaining({ type: 'directory', name: 'reports', relPath: 'reports' }),
+ expect.objectContaining({ type: 'file', name: 'README.md' }),
+ ]));
+ expect(await request({ op: 'listDir', relPath: 'reports' })).toEqual([
+ expect.objectContaining({ type: 'file', name: 'playtest.md', relPath: 'reports/playtest.md' }),
+ ]);
+ const result = await request<FileBrowserReadFileResult>({ op: 'readFile', relPath: 'reports/playtest.md' });
+ expect(result.ok).toBe(true);
+ if (result.ok) {
+ expect(result.data.content).toBe(project.files['reports/playtest.md']);
+ expect(result.data.size).toBe(new TextEncoder().encode(result.data.content).byteLength);
+ }
+ expect(await request({ op: 'readFile', relPath: '../private.md' })).toMatchObject({ ok: false, code: 'READ_FAILED' });
+ expect(await request({ op: 'listDir', relPath: '../' })).toEqual([]);
+ const all = await request<FileBrowserListAllFilesResult>({ op: 'listAllFiles', cap: 2 });
+ expect(all.files).toHaveLength(2);
+ expect(all.truncated).toBe(true);
+ expect(await request({ op: 'searchCollect', query: '24' })).toMatchObject({ matches: expect.arrayContaining([expect.objectContaining({ relPath: 'reports/playtest.md' })]) });
+ expect(await request({ op: 'searchCollect', query: 'does-not-exist' })).toMatchObject({ matches: [], totalFiles: 0, totalMatches: 0, truncated: false });
+ expect(await request({ op: 'searchCollect', query: 'orbit garden', caseSensitive: true })).toMatchObject({ matches: [], totalFiles: 0 });
+ expect(await request({ op: 'searchCollect', query: 'orbit garden', maxMatches: 1 })).toMatchObject({ matches: [expect.any(Object)], totalFiles: 1, totalMatches: 1, truncated: true });
+});
+
it('supplies valid demo plugin projections and confirms enable/disable through the real client', async () => {
const mock = await import('@/debug/visualMock');
const link = mock.createVisualMockDeviceLinkContext();
diff --git a/apps/mobile/src/debug/visualMock.ts b/apps/mobile/src/debug/visualMock.ts
index 448147d2ab..12ccbfe2a6 100644
--- a/apps/mobile/src/debug/visualMock.ts
+++ b/apps/mobile/src/debug/visualMock.ts
@@ -1,5 +1,5 @@
import { SHARED_REMOTE_CONTROL_FIXTURE } from '@cindy/maker-shared/fixtures';
-import { buildUiMockRows, type UiMockSessionRow } from '@cindy/maker-shared/ui-mock';
+import { buildUiMockRows, UI_MOCK_PROJECTS, type UiMockSessionRow } from '@cindy/maker-shared/ui-mock';
import { projectHistoryView } from '@cindy/maker-shared/message-window';
import { TASK_TAG_COLORS, type TaskTagRequest, type TaskTagResult } from '@cindy/maker-shared';
import { BOT_GROUP_CHAT_PRIMITIVE, BOT_GROUP_REMOTE_COLLECTION_ID, BOT_GROUP_REMOTE_RESOURCE_KIND } from '@cindy/maker-shared/botGroupChat';
@@ -779,6 +779,8 @@ function visualMockScheduleTemplates(): ReturnType<MobileMakerTransport['schedul
function handleVisualMockFileBrowser(input: unknown): unknown {
const op = input && typeof input === 'object' && 'op' in input ? String(input.op) : '';
+ const shared = sharedUiMockFiles(input);
+ if (shared !== undefined) return shared;
if (op === 'caps') return { ok: true, gzip: true } satisfies FileBrowserCapsResult;
if (op === 'listDir') return visualMockFileBrowserEntries();
if (op === 'listAllFiles') {
@@ -814,6 +816,51 @@ function handleVisualMockFileBrowser(input: unknown): unknown {
return visualMockFileBrowserEntries();
}
+/** Serve the same small project files Desktop seeds, without touching a real filesystem. */
+function sharedUiMockFiles(input: unknown): unknown {
+ if (!input || typeof input !== 'object') return undefined;
+ const request = input as Record<string, unknown>;
+ const workdir = String(request.workdir ?? '').replace(/\\/g, '/').replace(/\/$/, '');
+ const project = UI_MOCK_PROJECTS.find(item => workdir === `/Users/demo/Projects/${item.name}`);
+ if (!project) return undefined; // Keep the existing media/Markdown regression fixtures.
+ const relPath = String(request.relPath ?? '').replace(/\\/g, '/').replace(/^\.\//, '').replace(/\/$/, '');
+ const paths = Object.keys(project.files).sort();
+ if (request.op === 'caps') return { ok: true, completeDirectoryListing: true } satisfies FileBrowserCapsResult;
+ if (request.op === 'listAllFiles') {
+ const cap = typeof request.cap === 'number' && request.cap > 0 ? request.cap : paths.length;
+ return { files: paths.slice(0, cap), truncated: paths.length > cap, elapsedMs: 0 } satisfies FileBrowserListAllFilesResult;
+ }
+ if (request.op === 'listDir') {
+ const prefix = relPath ? `${relPath}/` : '';
+ const entries = new Map<string, { type: 'file' | 'directory'; name: string; relPath: string; size: number; mtimeMs: number }>();
+ for (const path of paths) {
+ if (!path.startsWith(prefix)) continue;
+ const remainder = path.slice(prefix.length);
+ const name = remainder.split('/')[0];
+ const directory = remainder.includes('/');
+ entries.set(name, { type: directory ? 'directory' : 'file', name, relPath: `${prefix}${name}`, size: directory ? 0 : new TextEncoder().encode(project.files[path]).byteLength, mtimeMs: NOW });
+ }
+ return [...entries.values()].sort((a, b) => Number(b.type === 'directory') - Number(a.type === 'directory') || a.name.localeCompare(b.name));
+ }
+ if (request.op === 'readFile') {
+ if (!Object.hasOwn(project.files, relPath)) return { ok: false, code: 'READ_FAILED', message: 'File not found in the demo project.' } satisfies FileBrowserReadFileResult;
+ const content = project.files[relPath];
+ return { ok: true, data: { relPath, content, size: new TextEncoder().encode(content).byteLength, mtimeMs: NOW } } satisfies FileBrowserReadFileResult;
+ }
+ if (request.op === 'searchCollect') {
+ const normalize = (value: string) => request.caseSensitive === true ? value : value.toLowerCase();
+ const query = normalize(String(request.query ?? ''));
+ const found = query ? paths.flatMap(path => project.files[path].split('\n').flatMap((line, index) =>
+ normalize(line).includes(query) ? [{ relPath: path, lineNumber: index + 1, lineText: line }] : [],
+ )) : [];
+ const cap = typeof request.maxMatches === 'number' && request.maxMatches > 0 ? Math.min(500, request.maxMatches) : 500;
+ const matches = found.slice(0, cap);
+ return { matches, truncated: found.length > cap, totalMatches: matches.length, totalFiles: new Set(matches.map(item => item.relPath)).size } satisfies FileBrowserSearchCollectResult;
+ }
+ if (request.op === 'thumbnail') return { ok: false, code: 'THUMB_UNSUPPORTED' } satisfies FileBrowserThumbnailResult;
+ return { ok: false, message: 'Unsupported demo file operation.' };
+}
+
function visualMockDirectory(): RemoteDirectoryListResult {
return {
resolvedPath: '/repo/xdt-maker',
diff --git a/docs/dev-rules/ui-mock-data.md b/docs/dev-rules/ui-mock-data.md
index 9e231d97ce..e6f6571dc0 100644
--- a/docs/dev-rules/ui-mock-data.md
+++ b/docs/dev-rules/ui-mock-data.md
@@ -3,21 +3,22 @@
> **读取时机**:要在 Desktop 或 Mobile 上检查界面、截图、做 UI 回归,又不想登录真实
> 账号或碰真实数据时;新增或修改模拟任务、`--mock` 启动参数时。
-Desktop 与 Mobile 共用一套模拟数据:两个项目、十来个不同状态的任务和它们的消息。开发版
+Desktop 与 Mobile 共用一套模拟数据:展示项目、不同状态的回归任务和它们的消息。开发版
加 `--mock` 启动后直接进入主界面,不登录、不连服务器,也不碰任何正式或共享数据。适合检查
任务列表、任务页、消息渲染、深浅色和多语言这类只关心界面的改动;登录、发送、跨设备、
真实 Agent 运行仍要用真实账号验证。
-| 端 | 启动 | 数据落在哪 |
-| --- | --- | --- |
-| Desktop | `pnpm restart:desktop:remote -- --mock` | 独立沙箱 `ui-mock`(与 `dev` 沙箱、正式版分开) |
-| Mobile 模拟器 | `pnpm mobile:sim:start -- --mock`(`whoami`、`rebuild` 同样加 `--mock`) | 只在 App 进程内存里 |
+| 端 | 启动 | 数据落在哪 |
+| ------------- | ------------------------------------------------------------------------ | ----------------------------------------------- |
+| Desktop | `pnpm restart:desktop:remote -- --mock` | 独立沙箱 `ui-mock`(与 `dev` 沙箱、正式版分开) |
+| Mobile 模拟器 | `pnpm mobile:sim:start -- --mock`(`whoami`、`rebuild` 同样加 `--mock`) | 只在 App 进程内存里 |
## 一套数据,两端共用
正本在 `packages/maker-shared/src/uiMock.ts`(`@cindy/maker-shared/ui-mock`):
-- `UI_MOCK_PROJECTS`:演示项目 `cindy-demo`、`design-system` 及几个小文件。
+- `UI_MOCK_PROJECTS`:`orbit-garden-zh` / `orbit-garden-en` 展示项目,以及原有
+ `cindy-demo`、`design-system` 回归项目和对应文件。
- `UI_MOCK_TASKS`:运行中、等待确认、排队、置顶、超长标题、英文、无文件夹对话、自动化、
已归档等任务;`登录页窄窗口错位排查` 一条覆盖标题、表格、代码块、列表、引用、思考与工具
调用。
@@ -70,7 +71,37 @@ pnpm mobile:sim:whoami -- --mock --json
`apps/mobile/src/debug/visualMock.ts` 在内存里提供,写操作只在本次进程内生效,重启即还原。
- 生效条件是开发构建(`__DEV__`);正式包不包含这条路径。
-## 边界
+## 可复用的展示项目:Orbit Garden
+
+共享目录现在包含 `orbit-garden-zh` / `orbit-garden-en`:同一个虚构独立游戏的中英文
+演示项目。数据定义在 `packages/maker-shared/src/uiMockShowcase.ts`,原有边界/异常回归
+任务保持不变。用现有 `--mock` 入口即可加载,不需要导入个人聊天或访问真实账号。
+
+| 场景 ID 后缀(前缀 `ui-mock-showcase-`) | 内容 |
+| ---------------------------------------- | ----------------------------------------------------- |
+| `feedback-zh` / `feedback-en` | 240 条合成反馈、四轮引导完成率、图表与复盘报告 |
+| `plan-zh` / `plan-en` | 可调人数/范围,实时计算工作量和制作天数;没有发送动作 |
+| `review-zh` / `review-en` | 合成代码审查场景,明确不是实际测试结果 |
+| `release-zh` / `release-en` | 未发送的试玩邀请草稿 |
+
+项目中的 `data/feedback.csv`、`data/completion.csv`、`reports/playtest.md` 与
+`plans/next-build.md` 和回答使用同一组数字。Desktop 创建这些小文件;Mobile 的 mock
+文件浏览通道读取同一目录,支持子目录、预览和搜索。两端仍是独立回放,**不代表已验证
+真实设备同步、远程桌面或 Agent 执行**。
+
+建议截图分工:桌面显示任务+回答+文件侧栏;笔记本聚焦回答;手机显示单栏;Duo 用真实
+展开布局显示任务与回答。不要裁掉错误提示后把结果当作验证通过,也不要将屏幕拉伸成
+另一种设备的布局。网页标注「真实界面 · 示例数据」。
+
+复用时记录源码版本/dirty 标识、场景 ID、区域、语言、主题、窗口尺寸或模拟器 UDID。
+切换界面语言不会翻译消息,需选择对应语言的任务。Desktop seed 不覆盖已有内容;修改
+文案后使用新的专用沙箱,不清空他人常用开发环境。截图只导航/查看/调整本地控件,不点
+发送;Desktop `--mock` 不是阻止真实模型调用的防火墙。
+
+数字与富回答协议回归:`packages/maker-shared/src/__tests__/uiMockShowcase.test.ts`。
+手机文件一致性回归:`apps/mobile/src/__tests__/visualMock.test.ts`。
+
+## 数据边界
- 模拟数据只用于开发与界面验收,不进安装包逻辑,不上传,不触发真实 Agent。
- 不在模拟数据里放真实姓名、邮箱、路径或聊天内容;要用真实数据预览手机界面时用
diff --git a/packages/maker-shared/src/__tests__/uiMockShowcase.test.ts b/packages/maker-shared/src/__tests__/uiMockShowcase.test.ts
new file mode 100644
index 0000000000..4d1fcbb86c
--- /dev/null
+++ b/packages/maker-shared/src/__tests__/uiMockShowcase.test.ts
@@ -0,0 +1,83 @@
+import { describe, expect, it } from "vitest";
+import { buildUiMockRows, UI_MOCK_PROJECTS, UI_MOCK_TASKS } from "../uiMock";
+import { UI_MOCK_SHOWCASE_TASKS } from "../uiMockShowcase";
+import {
+ RichAnswerStream,
+ richChart,
+ richLabel,
+ richResolvedValues,
+ splitRichAnswer,
+} from "../richAnswer";
+
+const documentFor = (id: string) => {
+ const task = UI_MOCK_TASKS.find((item) => item.id === id)!;
+ const message = task.messages.find((item) => item.role === "assistant")!;
+ if (!("text" in message)) throw new Error("Missing showcase answer");
+ const part = splitRichAnswer(message.text).find(
+ (item) => item.kind === "rich",
+ )!;
+ const doc = new RichAnswerStream().update(part.source, part.complete);
+ expect(doc.issues).toBe(0);
+ return doc;
+};
+
+describe("shared full-client showcase data", () => {
+ it("keeps deterministic task identities and valid project references on both path styles", () => {
+ expect(new Set(UI_MOCK_TASKS.map((task) => task.id)).size).toBe(
+ UI_MOCK_TASKS.length,
+ );
+ for (const projectRoot of ["/demo/Projects", "C:\\Demo\\Projects"]) {
+ const rows = buildUiMockRows({ now: 1_800_000_000_000, projectRoot });
+ for (const task of UI_MOCK_SHOWCASE_TASKS) {
+ expect(
+ UI_MOCK_PROJECTS.some((project) => project.name === task.project),
+ ).toBe(true);
+ expect(rows.sessions.find((row) => row.id === task.id)).toBeDefined();
+ }
+ expect(buildUiMockRows({ now: 1_800_000_000_000, projectRoot })).toEqual(
+ rows,
+ );
+ }
+ });
+
+ it.each(["zh", "en"])(
+ "uses the CSV numbers in the %s report and renders safe local controls",
+ (locale) => {
+ const project = UI_MOCK_PROJECTS.find(
+ (item) => item.name === `orbit-garden-${locale}`,
+ )!;
+ const counts = project.files["data/feedback.csv"]
+ .trim()
+ .split("\n")
+ .slice(1)
+ .map((row) => Number(row.split(",")[1]));
+ const trend = project.files["data/completion.csv"]
+ .trim()
+ .split("\n")
+ .slice(1)
+ .map((row) => Number(row.split(",")[1]));
+ const report = documentFor(`ui-mock-showcase-feedback-${locale}`);
+ const values = richResolvedValues(report);
+ expect(richLabel(report.nodes.get("feedback")!, values)).toBe(
+ String(counts.reduce((a, b) => a + b, 0)),
+ );
+ expect(
+ richChart(report.nodes.get("trend")!, values).map((item) => item.value),
+ ).toEqual(trend);
+ expect(richLabel(report.nodes.get("improvement")!, values)).toBe("+24");
+ const plan = documentFor(`ui-mock-showcase-plan-${locale}`);
+ const defaults = richResolvedValues(plan);
+ expect(defaults.hours).toBe(36);
+ expect(defaults.days).toBe(3);
+ const adjusted = richResolvedValues(plan, {
+ team: 4,
+ exploration: true,
+ haptics: true,
+ });
+ expect(adjusted.hours).toBe(48);
+ expect(adjusted.days).toBe(2);
+ for (const node of plan.nodes.values())
+ expect(node.props.send).toBeUndefined();
+ },
+ );
+});
diff --git a/packages/maker-shared/src/uiMock.ts b/packages/maker-shared/src/uiMock.ts
index 5807946457..4df4b2203a 100644
--- a/packages/maker-shared/src/uiMock.ts
+++ b/packages/maker-shared/src/uiMock.ts
@@ -1,3 +1,5 @@
+import { UI_MOCK_SHOWCASE_PROJECTS, UI_MOCK_SHOWCASE_TASKS } from './uiMockShowcase';
+
/**
* UI mock data shared by Desktop and Mobile dev builds.
*
@@ -41,6 +43,7 @@ export interface UiMockTask {
}
export const UI_MOCK_PROJECTS: readonly UiMockProject[] = [
+ ...UI_MOCK_SHOWCASE_PROJECTS,
{
name: 'cindy-demo',
files: {
@@ -88,6 +91,7 @@ const RICH_ANSWER = [
* ordinary tasks because those states live in the agent runtime, not the database.
*/
export const UI_MOCK_TASKS: readonly UiMockTask[] = [
+ ...UI_MOCK_SHOWCASE_TASKS,
{
id: 'visual-running',
title: '重构登录页布局',
diff --git a/packages/maker-shared/src/uiMockShowcase.ts b/packages/maker-shared/src/uiMockShowcase.ts
new file mode 100644
index 0000000000..db093bb472
--- /dev/null
+++ b/packages/maker-shared/src/uiMockShowcase.ts
@@ -0,0 +1,426 @@
+import type { RichAnswerKind } from "./richAnswer";
+import type { UiMockProject, UiMockTask } from "./uiMock";
+
+/** Synthetic, bilingual project for repeatable full-client screenshots. No real user data. */
+type Locale = "zh" | "en";
+type Node = {
+ id: string;
+ kind: RichAnswerKind;
+ parent?: string;
+ props: Record<string, unknown>;
+};
+const phrase = (locale: Locale, zh: string, en: string) =>
+ locale === "zh" ? zh : en;
+const answer = (summary: string, nodes: Node[]) =>
+ `${summary}\n\n\`\`\`cindy-ui\n${nodes
+ .map((node, index) =>
+ JSON.stringify({
+ seq: index + 1,
+ ...(index === 0 ? { version: 1 } : {}),
+ op: "create",
+ ...node,
+ }),
+ )
+ .join("\n")}\n\`\`\``;
+
+const feedback = [
+ { zh: "新手引导", en: "Onboarding", count: 86 },
+ { zh: "探索节奏", en: "Exploration", count: 64 },
+ { zh: "操作手感", en: "Controls", count: 52 },
+ { zh: "画面表现", en: "Visuals", count: 38 },
+] as const;
+const completion = [48, 56, 63, 72] as const;
+const feedbackTotal = feedback.reduce((total, item) => total + item.count, 0);
+
+function feedbackAnswer(locale: Locale): string {
+ const t = (zh: string, en: string) => phrase(locale, zh, en);
+ return answer(
+ t(
+ "先把开场十分钟做好,再扩充地图。",
+ "Make the first ten minutes shine before expanding the map.",
+ ),
+ [
+ { id: "report", kind: "stack", props: { style: { gap: 16 } } },
+ {
+ id: "eyebrow",
+ kind: "text",
+ parent: "report",
+ props: {
+ text: "ORBIT GARDEN / PLAYTEST 04",
+ style: {
+ fontFamily: "monospace",
+ fontSize: 11,
+ letterSpacing: 1.2,
+ color: "secondary",
+ },
+ },
+ },
+ {
+ id: "heading",
+ kind: "heading",
+ parent: "report",
+ props: {
+ text: t("让开场十分钟,更好玩", "A better first ten minutes"),
+ style: { fontSize: 25, fontWeight: 650, lineHeight: 1.25 },
+ },
+ },
+ {
+ id: "metrics",
+ kind: "grid",
+ parent: "report",
+ props: { columns: 3, mobileColumns: 3, style: { gap: 12 } },
+ },
+ {
+ id: "feedback",
+ kind: "stat",
+ parent: "metrics",
+ props: { label: t("试玩反馈", "Responses"), value: feedbackTotal },
+ },
+ {
+ id: "completion",
+ kind: "stat",
+ parent: "metrics",
+ props: {
+ label: t("引导完成率", "Completion"),
+ value: completion.at(-1),
+ suffix: "%",
+ },
+ },
+ {
+ id: "improvement",
+ kind: "stat",
+ parent: "metrics",
+ props: {
+ label: t("较首轮提升", "Point gain"),
+ prefix: "+",
+ value: completion[3] - completion[0],
+ },
+ },
+ {
+ id: "trend",
+ kind: "chart",
+ parent: "report",
+ props: {
+ label: t(
+ "每一次迭代,都让玩家多走一步",
+ "More players make it through with each build",
+ ),
+ variant: "line",
+ data: completion.map((value, index) => ({
+ label: `0${index + 1}`,
+ value,
+ })),
+ height: 160,
+ yMin: 40,
+ yMax: 80,
+ ticks: 3,
+ showValues: true,
+ showPoints: true,
+ showGrid: true,
+ strokeWidth: 2.5,
+ pointRadius: 3,
+ },
+ },
+ { id: "rule", kind: "divider", parent: "report", props: {} },
+ {
+ id: "next",
+ kind: "text",
+ parent: "report",
+ props: {
+ text: t(
+ "下一步 · 缩短教学,提前开放自由探索。",
+ "Next · Less tutorial. More room to explore.",
+ ),
+ style: { fontWeight: 600, fontSize: 15 },
+ },
+ },
+ {
+ id: "evidence",
+ kind: "text",
+ parent: "report",
+ props: {
+ text: t(
+ "86 条反馈指向新手引导,是最集中的改进机会。",
+ "Onboarding leads with 86 mentions: the clearest place to start.",
+ ),
+ style: { color: "secondary", fontSize: 13 },
+ },
+ },
+ {
+ id: "source",
+ kind: "text",
+ parent: "report",
+ props: {
+ text: t(
+ "示例数据 · 完整分析见 reports/playtest.md",
+ "Synthetic data · Full analysis in reports/playtest.md",
+ ),
+ style: { color: "tertiary", fontSize: 11 },
+ },
+ },
+ ],
+ );
+}
+
+function planAnswer(locale: Locale): string {
+ const t = (zh: string, en: string) => phrase(locale, zh, en);
+ return answer(
+ t(
+ "先做一轮小而完整的改进。拖动人数、调整范围,就能比较计划。",
+ "Keep the next iteration focused. Adjust the team and scope to compare plans.",
+ ),
+ [
+ { id: "plan", kind: "stack", props: { style: { gap: 16 } } },
+ {
+ id: "eyebrow",
+ kind: "text",
+ parent: "plan",
+ props: {
+ text: "ORBIT GARDEN / NEXT BUILD",
+ style: {
+ fontFamily: "monospace",
+ fontSize: 11,
+ letterSpacing: 1.2,
+ color: "secondary",
+ },
+ },
+ },
+ {
+ id: "heading",
+ kind: "heading",
+ parent: "plan",
+ props: {
+ text: t("下一轮试玩,怎么排?", "Shape the next playtest"),
+ style: { fontSize: 25, fontWeight: 650 },
+ },
+ },
+ {
+ id: "team",
+ kind: "range",
+ parent: "plan",
+ props: {
+ label: t("投入人数", "People on this build"),
+ min: 1,
+ max: 4,
+ step: 1,
+ default: 2,
+ suffix: t("人", " people"),
+ },
+ },
+ {
+ id: "exploration",
+ kind: "check",
+ parent: "plan",
+ props: {
+ label: t(
+ "提前开放自由探索 · +12 小时",
+ "Open exploration earlier · +12 hours",
+ ),
+ default: true,
+ },
+ },
+ {
+ id: "haptics",
+ kind: "check",
+ parent: "plan",
+ props: {
+ label: t(
+ "增加手柄反馈 · +12 小时",
+ "Add controller feedback · +12 hours",
+ ),
+ default: false,
+ },
+ },
+ { id: "rule", kind: "divider", parent: "plan", props: {} },
+ {
+ id: "estimate",
+ kind: "grid",
+ parent: "plan",
+ props: { columns: 2, mobileColumns: 2, style: { gap: 24 } },
+ },
+ {
+ id: "hours",
+ kind: "stat",
+ parent: "estimate",
+ props: {
+ label: t("预计工作量", "Estimated effort"),
+ value: {
+ op: "add",
+ args: [
+ 24,
+ { op: "if", args: [{ ref: "exploration" }, 12, 0] },
+ { op: "if", args: [{ ref: "haptics" }, 12, 0] },
+ ],
+ },
+ suffix: t(" 小时", " h"),
+ },
+ },
+ {
+ id: "days",
+ kind: "stat",
+ parent: "estimate",
+ props: {
+ label: t("预计制作时间", "Build time"),
+ value: {
+ op: "div",
+ args: [{ ref: "hours" }, { op: "mul", args: [{ ref: "team" }, 6] }],
+ },
+ suffix: t(" 天", " days"),
+ },
+ },
+ {
+ id: "scope",
+ kind: "text",
+ parent: "plan",
+ props: {
+ text: t(
+ "基础范围:重写引导、整理反馈、回归验证。",
+ "Core scope: tutorial rewrite, feedback triage, and regression checks.",
+ ),
+ style: { fontSize: 13, color: "secondary" },
+ },
+ },
+ {
+ id: "note",
+ kind: "text",
+ parent: "plan",
+ props: {
+ text: t(
+ "每人每天按 6 小时估算;不含外部等待。调整只用于比较,不会启动任务。",
+ "Assumes 6 focused hours per person per day; excludes external waits. Controls compare plans only.",
+ ),
+ style: { fontSize: 11, color: "tertiary" },
+ },
+ },
+ ],
+ );
+}
+
+function project(locale: Locale): UiMockProject {
+ const t = (zh: string, en: string) => phrase(locale, zh, en);
+ return {
+ name: `orbit-garden-${locale}`,
+ files: {
+ "README.md": t(
+ "# 星间花园 / Orbit Garden\n\n一款关于探索、种植与小小发现的虚构独立游戏。\n\n这套合成项目用于 Cindy 开发测试和官网界面展示,不是真实用户或产品的成绩。\n\n## 本轮目标\n\n把开场十分钟做好:缩短教学、提前开放探索、保留玩家自己发现的乐趣。\n\n- reports/playtest.md:试玩复盘\n- data/feedback.csv:240 条反馈的主题汇总\n- data/completion.csv:四轮引导完成率\n- plans/next-build.md:下一轮制作计划\n",
+ "# Orbit Garden\n\nA fictional indie game about exploring, growing, and small discoveries.\n\nSynthetic project for Cindy development and website screenshots, not real customer or product results.\n\n## This build\n\nMake the first ten minutes shine: a shorter tutorial, earlier exploration, and room for discovery.\n\n- reports/playtest.md: playtest findings\n- data/feedback.csv: topic counts from 240 synthetic responses\n- data/completion.csv: completion across four builds\n- plans/next-build.md: the next iteration\n",
+ ),
+ "data/feedback.csv": `topic,responses\n${feedback.map((item) => `${item.en},${item.count}`).join("\n")}\n`,
+ "data/completion.csv": `build,completion_percent\n${completion.map((value, index) => `0${index + 1},${value}`).join("\n")}\n`,
+ "reports/playtest.md": t(
+ `# 把开场十分钟做好\n\n> Orbit Garden · 第 04 轮试玩 · 合成演示数据\n\n## 已经变好的部分\n\n引导完成率从 48% 提升到 72%,提高了 24 个百分点。\n\n## 玩家还在意什么\n\n${feedback.map((item) => `- ${item.zh}:${item.count} 条`).join("\n")}\n\n共 ${feedbackTotal} 条反馈,每条只计入一个主要主题。\n\n## 下一步\n\n1. 把开场教学压缩为三个可操作的步骤。\n2. 提前开放第一片自由探索区域。\n3. 下一轮继续观察引导完成率,不急着扩充地图。\n`,
+ `# Make the first ten minutes shine\n\n> Orbit Garden · Playtest 04 · Synthetic demo data\n\n## What improved\n\nTutorial completion rose from 48% to 72%, a gain of 24 percentage points.\n\n## What players still mention\n\n${feedback.map((item) => `- ${item.en}: ${item.count}`).join("\n")}\n\n${feedbackTotal} responses; each counted under one primary topic.\n\n## Next build\n\n1. Reduce the opening tutorial to three playable steps.\n2. Open the first free-exploration area earlier.\n3. Track completion again before expanding the map.\n`,
+ ),
+ "plans/next-build.md": t(
+ "# 下一轮试玩\n\n合成估算;每人每天 6 小时,不含外部等待。\n\n| 范围 | 小时 |\n| --- | ---: |\n| 重写引导、整理反馈与回归验证 | 24 |\n| 提前开放自由探索(已选) | 12 |\n| 增加手柄反馈(备选) | 12 |\n\n当前方案:36 小时,2 人投入,预计 3 天。对话里的控件只比较方案,不启动工作。\n",
+ "# Next playtest\n\nSynthetic estimate; 6 focused hours per person per day, excluding external waits.\n\n| Scope | Hours |\n| --- | ---: |\n| Tutorial rewrite, feedback triage, regression checks | 24 |\n| Earlier exploration (selected) | 12 |\n| Controller feedback (optional) | 12 |\n\nCurrent plan: 36 hours across 2 people, estimated at 3 days. Conversation controls compare plans without starting work.\n",
+ ),
+ },
+ };
+}
+
+function tasks(locale: Locale): UiMockTask[] {
+ const t = (zh: string, en: string) => phrase(locale, zh, en);
+ const common = {
+ project: `orbit-garden-${locale}`,
+ effort: "high",
+ status: "active",
+ source: "desktop",
+ pinned: true,
+ } as const;
+ return [
+ {
+ ...common,
+ id: `ui-mock-showcase-feedback-${locale}`,
+ title: t("星间花园 · 试玩复盘", "Orbit Garden · Playtest findings"),
+ agentKind: "cc",
+ model: "claude-sonnet-5-5",
+ minutesAgo: 0,
+ messages: [
+ {
+ role: "user",
+ text: t(
+ "看看这轮试玩反馈,下一版最值得改什么?",
+ "Look through the playtest feedback. What should we improve next?",
+ ),
+ },
+ { role: "assistant", text: feedbackAnswer(locale) },
+ ],
+ },
+ {
+ ...common,
+ id: `ui-mock-showcase-plan-${locale}`,
+ title: t("下一轮试玩 · 交互计划", "Next playtest · Interactive plan"),
+ agentKind: "pi",
+ model: "chatgpt/gpt-6.1-sol",
+ minutesAgo: 2,
+ messages: [
+ {
+ role: "user",
+ text: t(
+ "我们有两个人。帮我比较一下下一轮的制作范围。",
+ "There are two of us. Help me compare the scope for our next build.",
+ ),
+ },
+ { role: "assistant", text: planAnswer(locale) },
+ ],
+ },
+ {
+ ...common,
+ id: `ui-mock-showcase-review-${locale}`,
+ title: t("引导流程 · 代码审查", "Tutorial flow · Code review"),
+ agentKind: "codex",
+ model: "gpt-6.1-sol",
+ minutesAgo: 8,
+ messages: [
+ {
+ role: "user",
+ text: t(
+ "新引导准备好了,检查一下边界情况。",
+ "The new tutorial is ready. Check the edge cases.",
+ ),
+ },
+ {
+ role: "assistant",
+ text: t(
+ "重点检查了跳过引导、重新进入和手柄操作三条路径。下一轮试玩时,先确认玩家跳过教学后仍能找到第一片花园。\n\n这是合成审查场景,不代表实际执行了测试。",
+ "Reviewed the skip, re-entry, and controller paths in this demo scenario. In the next playtest, first check whether players who skip the tutorial can still find the first garden.\n\nSynthetic review scenario; no real tests were executed.",
+ ),
+ },
+ ],
+ },
+ {
+ ...common,
+ id: `ui-mock-showcase-release-${locale}`,
+ title: t("试玩邀请 · 中英双语", "Playtest invitation · Two languages"),
+ agentKind: "pi",
+ model: "chatgpt/gpt-6.1-sol",
+ minutesAgo: 18,
+ messages: [
+ {
+ role: "user",
+ text: t(
+ "写一段下一轮试玩邀请,轻松一点。",
+ "Write a friendly invitation for the next playtest.",
+ ),
+ },
+ {
+ role: "assistant",
+ text: t(
+ "花园又长大了一点。\n\n这次,你能更早走出小径,种下第一颗种子。欢迎来逛十分钟,再告诉我们:哪个瞬间让你想继续玩?\n\n*合成演示文案,尚未发送。*",
+ "The garden has grown a little.\n\nStep off the path sooner, plant your first seed, and see what turns up. Come spend ten minutes with us, then tell us: which moment made you want to keep playing?\n\n*Synthetic draft. Not sent.*",
+ ),
+ },
+ ],
+ },
+ ];
+}
+
+export const UI_MOCK_SHOWCASE_PROJECTS: readonly UiMockProject[] = [
+ "zh",
+ "en",
+].map((locale) => project(locale as Locale));
+export const UI_MOCK_SHOWCASE_TASKS: readonly UiMockTask[] = [
+ "zh",
+ "en",
+].flatMap((locale) => tasks(locale as Locale));