补充普通用户操作导引入口

新增 /guide 纯聊天操作导引

补充 /next 与 /help 的导引入口覆盖

验证 /guide 不触发文件读取、运行、预览、导出或写入

同步 AI 游戏创作 App 技术方案和决策记录
This commit is contained in:
AIGameCreator App
2026-07-04 14:48:10 +08:00
parent 7fc7f930c6
commit 5649316217
4 changed files with 182 additions and 2 deletions
+79
View File
@@ -1913,6 +1913,7 @@ const chatCommandHelp = [
'/timeline:查看项目活动时间线',
'/handoff:生成当前项目交接摘要',
'/next:查看下一步建议',
'/guide:查看普通用户操作导引',
'/plan:查看下一轮分工计划',
'/todo:查看下一轮小步清单',
'/publish:查看发布准备清单',
@@ -6508,6 +6509,7 @@ function summarizeNextProjectActions(
addSuggestion('查看最近 loop 进展', '/trace');
}
addSuggestion('查看创作目标', '/goal');
addSuggestion('查看普通用户操作导引', '/guide');
addSuggestion('查看创作规格包', '/spec');
addSuggestion('查看本轮 MVP 范围', '/mvp');
addSuggestion('查看试玩定位与卖点', '/pitch');
@@ -6618,6 +6620,66 @@ function summarizeNextProjectActions(
};
}
function summarizeProjectUserGuide(
nextManifest: GameCreationAppManifest,
trace: GameCreationAgentRunTrace | null,
) {
const preview = nextManifest.preview;
const previewRunning = preview?.status === 'running' && preview.url;
const tracePassed = isAgentRunTracePassed(trace);
const blockedTrace =
trace?.lifecycleStatus === 'killed' ||
trace?.status === 'failed' ||
trace?.status === 'needs-revision' ||
trace?.stopReason === 'max-passes-exhausted';
const exported = (nextManifest.commandRuns ?? []).some(
(commandRun) =>
commandRun.commandId === 'project.export_package' &&
commandRun.status === 'completed',
);
let stage = '未开始';
let nextAction = '先确认一句游戏目标,再生成首版原型。';
let recommendedCommands = ['/brief', '/mvp', '/next'];
if (blockedTrace) {
stage = '需修复';
nextAction = '先看评审和阻塞,再把修复说明交回 agent。';
recommendedCommands = ['/review', '/todo', '/plan'];
} else if (exported) {
stage = '已导出';
nextAction = '先检查试玩包和交付材料,再发给测试者。';
recommendedCommands = ['/exports', '/share', '/listing'];
} else if (previewRunning) {
stage = '可预览';
nextAction = '先打开本地预览试玩一轮,再记录反馈。';
recommendedCommands = ['/open-preview', '/test-plan', '/feedback'];
} else if (tracePassed) {
stage = '可导出';
nextAction = '先运行自检并启动本地预览,通过后再导出试玩包。';
recommendedCommands = ['/run', '/test-plan', '/share'];
} else if (trace) {
stage = '生成中/待验收';
nextAction = '先看最近 loop 和下一轮小步,再决定是否继续。';
recommendedCommands = ['/trace', '/todo', '/plan'];
}
const draftCommand = recommendedCommands[0];
return {
text: [
'使用导引:',
`- 项目:${nextManifest.name}`,
`- 当前阶段:${stage}`,
`- 现在先做:${nextAction}`,
`- 推荐命令:${recommendedCommands.join(' / ')}`,
'- 边界:只给操作导引;不读取文件;不启动 run;不启动预览;不写项目',
].join('\n'),
draftCommand,
draftCommandLabel: '执行导引建议',
};
}
function summarizeMainProjectHeader(
nextManifest: GameCreationAppManifest,
agents: AgentStatusCard[],
@@ -11073,6 +11135,23 @@ export function App() {
return;
}
if (prompt === '/guide') {
if (!requireChatProjectForUserAction()) {
return;
}
const summary = summarizeProjectUserGuide(manifest, agentRunTrace);
setMessages((current) => [
...current,
{
role: 'assistant',
text: summary.text,
draftCommand: summary.draftCommand,
draftCommandLabel: summary.draftCommandLabel,
},
]);
return;
}
if (prompt === '/plan') {
if (!requireChatProjectForUserAction()) {
return;
@@ -5175,6 +5175,100 @@ describe('AI 游戏创作 App 界面边界', () => {
invoke.mock.calls.filter(([command]) => command === 'control_agent_run'),
).toHaveLength(commandCountsBeforePlan.controlAgentRun);
const commandCountsBeforeGuide = {
manifestRead: invoke.mock.calls.filter(
([command]) => command === 'get_local_game_manifest',
).length,
fileRead: invoke.mock.calls.filter(
([command]) => command === 'read_local_project_file',
).length,
fileList: invoke.mock.calls.filter(
([command]) => command === 'list_local_project_files',
).length,
runLocal: invoke.mock.calls.filter(
([command]) => command === 'run_limited_local_command',
).length,
startPreview: invoke.mock.calls.filter(
([command]) => command === 'start_local_game_preview',
).length,
openPreview: invoke.mock.calls.filter(
([command]) => command === 'open_local_game_preview',
).length,
exportPackage: invoke.mock.calls.filter(
([command]) => command === 'export_local_project_package',
).length,
exportList: invoke.mock.calls.filter(
([command]) => command === 'list_local_project_export_packages',
).length,
controlAgentRun: invoke.mock.calls.filter(
([command]) => command === 'control_agent_run',
).length,
};
submitChat('/guide');
const guideMessages = await screen.findAllByText(/使用导引:/);
const guideMessage = guideMessages[guideMessages.length - 1];
expect(guideMessage.textContent).toContain('项目:未命名游戏原型');
expect(guideMessage.textContent).toContain('当前阶段:可导出');
expect(guideMessage.textContent).toContain(
'现在先做:先运行自检并启动本地预览,通过后再导出试玩包。',
);
expect(guideMessage.textContent).toContain(
'推荐命令:/run / /test-plan / /share',
);
expect(guideMessage.textContent).toContain(
'边界:只给操作导引;不读取文件;不启动 run;不启动预览;不写项目',
);
const guideMessageList = document.querySelector('.message-list');
expect(guideMessageList).not.toBeNull();
const guideDraftButtons = within(
guideMessageList as HTMLElement,
).getAllByRole('button', { name: '执行导引建议' });
fireEvent.click(guideDraftButtons[guideDraftButtons.length - 1]);
expect(screen.getByLabelText('创作想法')).toHaveProperty('value', '/run');
expect(
invoke.mock.calls.filter(
([command]) => command === 'get_local_game_manifest',
),
).toHaveLength(commandCountsBeforeGuide.manifestRead);
expect(
invoke.mock.calls.filter(
([command]) => command === 'read_local_project_file',
),
).toHaveLength(commandCountsBeforeGuide.fileRead);
expect(
invoke.mock.calls.filter(
([command]) => command === 'list_local_project_files',
),
).toHaveLength(commandCountsBeforeGuide.fileList);
expect(
invoke.mock.calls.filter(
([command]) => command === 'run_limited_local_command',
),
).toHaveLength(commandCountsBeforeGuide.runLocal);
expect(
invoke.mock.calls.filter(
([command]) => command === 'start_local_game_preview',
),
).toHaveLength(commandCountsBeforeGuide.startPreview);
expect(
invoke.mock.calls.filter(
([command]) => command === 'open_local_game_preview',
),
).toHaveLength(commandCountsBeforeGuide.openPreview);
expect(
invoke.mock.calls.filter(
([command]) => command === 'export_local_project_package',
),
).toHaveLength(commandCountsBeforeGuide.exportPackage);
expect(
invoke.mock.calls.filter(
([command]) => command === 'list_local_project_export_packages',
),
).toHaveLength(commandCountsBeforeGuide.exportList);
expect(
invoke.mock.calls.filter(([command]) => command === 'control_agent_run'),
).toHaveLength(commandCountsBeforeGuide.controlAgentRun);
const runLocalCountBeforeNext = invoke.mock.calls.filter(
([command]) => command === 'run_limited_local_command',
).length;
@@ -5182,6 +5276,7 @@ describe('AI 游戏创作 App 界面边界', () => {
expect(await screen.findByText(/下一步建议:/)).not.toBeNull();
expect(screen.getByText(/运行自检并启动本地预览:\/run/)).not.toBeNull();
expect(screen.getByText(/查看创作目标:\/goal/)).not.toBeNull();
expect(screen.getByText(/查看普通用户操作导引:\/guide/)).not.toBeNull();
expect(screen.getByText(/查看创作规格包:\/spec/)).not.toBeNull();
expect(screen.getByText(/查看本轮 MVP 范围:\/mvp/)).not.toBeNull();
expect(screen.getByText(/查看试玩定位与卖点:\/pitch/)).not.toBeNull();
@@ -13046,6 +13141,9 @@ describe('AI 游戏创作 App 界面边界', () => {
).not.toBeNull();
expect(screen.getByText(/\/brief:生成当前项目简报/)).not.toBeNull();
expect(screen.getByText(/\/goal:查看创作目标/)).not.toBeNull();
expect(
screen.getByText(/\/guide:查看普通用户操作导引/),
).not.toBeNull();
expect(screen.getByText(/\/spec:查看创作规格包/)).not.toBeNull();
expect(screen.getByText(/\/mvp:查看本轮最小可玩范围/)).not.toBeNull();
expect(screen.getByText(/\/pitch:查看试玩定位与卖点/)).not.toBeNull();
@@ -3867,6 +3867,7 @@
- 2026-07-03 调整:主窗口 header 常驻项目摘要只从当前已加载的 manifest / trace 派生任务完成数、ready 数、资产来源分布和最近命令结果;未选择工作区时不显示,不为了摘要额外触发 Tauri 读取或写入,也不把任务、文件、run history 或预览开发面板搬进普通用户窗口。
- 2026-07-03 调整:普通用户通过聊天输入 `/brief` 触发项目简报入口,只基于主窗口当前已加载的 manifest、最近 run trace、预览状态、资产数量和最近命令生成聊天内简报,并提供 `/next` 作为后续草稿;该入口不得触发 Tauri 读写、不得读取文件、不得启动或打开预览,也不得新增普通用户面板。
- 2026-07-03 调整:普通用户通过聊天输入 `/goal` 查看创作目标,只基于当前 manifest.goal、最近 run goal 和 taskGraph.goal 汇总项目目标来源,并提供 `/agent-resume 细化目标:``/next` 草稿;该入口不得触发 Tauri 读写、不得读取 spec、上下文或 trace 文件,也不得新增普通用户目标面板。
- 2026-07-04 调整:普通用户通过聊天输入 `/guide` 查看操作导引,只基于当前 manifest、最近 run trace、preview 和已加载命令状态判断未开始、需修复、可预览、可导出或已导出阶段,给出最多 3 个推荐命令和首选草稿;该入口不得触发 Tauri 读写、不得读取文件、不得启动 run、不得启动预览、不得写项目,也不得新增普通用户导引面板。`/guide` 只回答“下一步怎么操作”,不承接 `/brief` 的项目快照、`/mvp` 的最小范围或 `/plan` 的分工计划。
- 2026-07-04 调整:普通用户通过聊天输入 `/spec` 查看创作规格包,只基于当前 manifest、最近 run trace、任务声明产物和 trace 输入 / 输出路径汇总 Planner 规格、玩法设计、数值表、美术清单、音频清单和发布说明状态,并提供 `/read .agent/spec.md``/next` 草稿;该入口不得触发 Tauri 读写、不得读取规格文件、不得启动预览、不得写项目,也不得新增普通用户规格面板。
- 2026-07-03 调整:普通用户通过聊天输入 `/mvp` 查看本轮最小可玩范围,只基于当前 manifest、最近 run trace、preview、任务、资产和最近命令汇总 MVP 内、当前状态、试玩包状态和暂不做事项,并提供 `/review``/criteria``/trace``/run``/export``/exports``/next` 草稿;该入口不得触发 Tauri 读写、不得读取文件、不得启动或打开预览、不得导出试玩包,也不得新增普通用户 MVP 面板。
- 2026-07-03 调整:普通用户通过聊天输入 `/pitch` 查看试玩定位与卖点,只基于当前 manifest、最近 run trace 和 preview 状态汇总试玩定位、一句话、核心乐趣、当前可演示状态、测试者讲解口径和暂不承诺事项,并提供 `/mvp``/review``/trace``/open-preview``/run` 草稿;该入口不得触发 Tauri 读写、不得读取文件、不得启动或打开预览、不得直接继续 run,也不得新增普通用户定位面板。该入口服务试玩讲解,不承接 `/listing` 的作品页包装。
@@ -3926,7 +3927,7 @@
- 2026-07-03 调整:普通用户通过聊天输入 `/balance` 查看数值与难度口径,只基于当前 manifest.tasks、最近 run trace.taskGraph、trace artifacts 和 steps 汇总数值组任务、验收口径、`game/balance.json` 状态和最近数值步骤,并提供 `/read game/balance.json``/agent-resume 数值调整:...` 草稿;该入口不得触发 Tauri 读写、不得读取数值表、不得启动预览或继续 run,也不得新增普通用户数值面板。
- 2026-07-03 调整:主窗口新增常用生成产物读取入口,只把入口 HTML、设计、数值、美术清单、音频清单和发布说明对应的 `/read` 草稿填入聊天输入框;聊天命令 `/artifacts` 只列出同一组固定读取命令并提供首个读取草稿,`/run-artifacts` 只列出最近 trace 里的产物读取命令并提供首个 `/read` 草稿,`/logs` 只列出固定日志读取命令;实际读取仍走聊天侧 `file.read` 权限流,不直接读本地文件。
- 2026-07-03 调整:普通用户通过聊天输入 `/share` 准备试玩交付清单,只基于当前 manifest、授权项目路径、最近 run trace、preview 状态和 manifest.commandRuns 汇总原型通过状态、本地预览、本地试玩包、测试者说明和反馈收集方向,并提供 `/export``/exports``/trace``/review``/next` 草稿;该入口不得触发 Tauri 读写、不得导出试玩包、不得列出历史包、不得上传云端、不得生成公开分享链接,也不得新增普通用户分享面板。
- 2026-07-03 调整,2026-07-04 更新:普通用户通过聊天输入 `/next` 触发下一步建议入口,只基于主窗口当前已加载的 manifest、最近 run trace 和最近命令摘要生成聊天建议,列出 `/goal``/spec``/mvp``/pitch``/demo``/rules``/tutorial``/mobile``/compatibility``/accessibility``/localization``/performance``/polish``/blockers``/ready``/evidence``/deps``/revise``/privacy``/audience``/invite``/bug-report``/survey``/cover``/screenshots``/trailer``/faq``/post``/store``/media-kit``/release-notes``/known-issues``/tasks``/criteria``/groups``/balance``/budget``/qa``/changes``/plan``/todo``/trace``/review``/context``/timeline``/playtest``/test-plan``/feedback``/retention``/share``/listing``/run``/open-preview``/assets``/credits``/art``/audio``/publish``/artifacts``/run-artifacts``/passes``/run-files``/internals``/logs``/agent-resume ` 等安全命令草稿方向,并提供一个首选草稿;该命令不得直接执行 Tauri 读写、启动或打开预览、读取本地文件,也不得绕过原有命令确认和 `file.read` 权限流。
- 2026-07-03 调整,2026-07-04 更新:普通用户通过聊天输入 `/next` 触发下一步建议入口,只基于主窗口当前已加载的 manifest、最近 run trace 和最近命令摘要生成聊天建议,列出 `/goal``/guide``/spec``/mvp``/pitch``/demo``/rules``/tutorial``/mobile``/compatibility``/accessibility``/localization``/performance``/polish``/blockers``/ready``/evidence``/deps``/revise``/privacy``/audience``/invite``/bug-report``/survey``/cover``/screenshots``/trailer``/faq``/post``/store``/media-kit``/release-notes``/known-issues``/tasks``/criteria``/groups``/balance``/budget``/qa``/changes``/plan``/todo``/trace``/review``/context``/timeline``/playtest``/test-plan``/feedback``/retention``/share``/listing``/run``/open-preview``/assets``/credits``/art``/audio``/publish``/artifacts``/run-artifacts``/passes``/run-files``/internals``/logs``/agent-resume ` 等安全命令草稿方向,并提供一个首选草稿;该命令不得直接执行 Tauri 读写、启动或打开预览、读取本地文件,也不得绕过原有命令确认和 `file.read` 权限流。
- 2026-07-03 调整:普通用户通过聊天输入 `/publish` 生成发布准备清单,只基于主窗口当前已加载的 manifest、最近 run trace、预览状态、资产来源和最近命令摘要列出原型通过、预览、任务、资产、音频、包装说明和试玩包状态,并提供 `/run``/trace``/agent-resume ``/export` 草稿;该入口不得触发 Tauri 读写、不得启动或打开预览、不得读取文件,也不得新增普通用户发布面板。
- 2026-07-03 调整:普通用户通过聊天输入 `/internals` 只列出 `.agent/manifest.json``.agent/run.latest.json``.agent/spec.md``.agent/findings.md``.agent/policy.json``.agent/project.index.json``.agent/agent.db``.agent/conversations/project.jsonl``/read` 草稿,并提供首个读取草稿;该入口不得直接读取内部文件、不得触发 Tauri 读写,也不得新增普通用户内部文件面板。
- 2026-07-03 调整:普通用户通过聊天输入 `/passes` 只从当前已加载的最近 run trace artifacts 中筛选 `.agent/passes/` 轮次产物,列出 `/read` 草稿并提供首个读取草稿;该入口不得直接读取轮次文件、不得触发 Tauri 读写,也不得新增普通用户轮次面板。
File diff suppressed because one or more lines are too long