4a46f89c9b
客户端新增随包提供的插件宿主和 Cocos Creator 集成:识别并导入 Cocos 项目,通过内置桥接操作已打开的编辑器,无需安装项目 MCP 扩展。DirectProject 现在公开 36 个独立 cocos_* 工具,保留通用 JavaScript 执行入口。 - 通用插件 SDK、命令/能力/面板注册、编辑器适配器和跨进程内置插件开关。 - Cocos 场景、节点、组件、Prefab、UI、Layout/Widget、资源、保存、撤销、日志与预览调试;目录和实现由 JS/native 共用。 - 编辑事务回读、失败回滚、后续手动修改保护及不确定结果禁止重放;预览截图通过 MCP image 返回。 - DirectProject 跳过无关专业 Agent 历史,将项目打开和历史读取中的同步 I/O 移出窗口线程,消除 Cocos 执行与项目文件锁的错误耦合。 验证: - 合并 master 后:类型/配置检查、编码检查、Rust 格式检查和提交钩子通过。 - 合并 master 后:Cocos 项目打开、插件面板和开发启动定向测试 10 通过、2 跳过;DirectProject MCP 测试 17 通过、1 项真实 Creator opt-in 忽略;插件宿主测试 9/9。 - 插件行为测试 17/17;native 测试 20/20,4 项 opt-in 测试默认忽略。 - 真实 Creator 3.8.8 的 36/36 操作 smoke,以及客户端 MCP tools/list、tools/call、UI/撤销和预览截图,在功能实现阶段已验证通过;本次 master 合并后未重复真实 GUI smoke。 验证边界:发行安装包和远端 CI 尚未验收。 Reviewed-on: #338 Co-authored-by: kdletters <kdletters@qq.com> Co-committed-by: kdletters <kdletters@qq.com>
141 lines
5.3 KiB
TypeScript
141 lines
5.3 KiB
TypeScript
import { createRequire } from 'node:module';
|
|
import path from 'node:path';
|
|
|
|
import { defineConfig } from 'vitest/config';
|
|
|
|
const aiGameCreatorRequire = createRequire(
|
|
path.resolve(__dirname, 'apps/ai-game-creator-shell/package.json'),
|
|
);
|
|
const reactFileManagerPackageRoot = path.dirname(
|
|
aiGameCreatorRequire.resolve('@cubone/react-file-manager/package.json'),
|
|
);
|
|
|
|
export default defineConfig({
|
|
resolve: {
|
|
alias: [
|
|
{
|
|
find: /^@cubone\/react-file-manager$/,
|
|
replacement: path.resolve(
|
|
reactFileManagerPackageRoot,
|
|
'dist/react-file-manager.es.js',
|
|
),
|
|
},
|
|
// Keep shared components' application-root imports resolvable in tests.
|
|
{ find: '@', replacement: path.resolve(__dirname, '.') },
|
|
{
|
|
find: '@genarrative/image-canvas-core',
|
|
replacement: path.resolve(
|
|
__dirname,
|
|
'packages/image-canvas-core/src/index.ts',
|
|
),
|
|
},
|
|
{
|
|
find: '@genarrative/image-canvas-react',
|
|
replacement: path.resolve(
|
|
__dirname,
|
|
'packages/image-canvas-react/src/index.ts',
|
|
),
|
|
},
|
|
// The standalone AI shell owns its Tauri guest dependencies. Root tests
|
|
// use inert aliases so the root H5 package keeps the HostBridge boundary.
|
|
{
|
|
find: '@tauri-apps/plugin-clipboard-manager',
|
|
replacement: path.resolve(
|
|
__dirname,
|
|
'apps/ai-game-creator-shell/tests/tauri-plugin-clipboard-manager.mock.ts',
|
|
),
|
|
},
|
|
{
|
|
find: '@tauri-apps/plugin-opener',
|
|
replacement: path.resolve(
|
|
__dirname,
|
|
'apps/ai-game-creator-shell/tests/tauri-plugin-opener.mock.ts',
|
|
),
|
|
},
|
|
// Keep every workspace test on the root install's single React renderer.
|
|
{
|
|
find: 'react',
|
|
replacement: path.resolve(__dirname, 'node_modules/react'),
|
|
},
|
|
{
|
|
find: 'react-dom',
|
|
replacement: path.resolve(__dirname, 'node_modules/react-dom'),
|
|
},
|
|
],
|
|
dedupe: ['react', 'react-dom', 'zustand'],
|
|
},
|
|
test: {
|
|
environment: 'node',
|
|
globals: true,
|
|
minThreads: 1,
|
|
maxThreads: 8,
|
|
server: {
|
|
deps: {
|
|
inline: [
|
|
/apps\/ai-game-creator-shell\/node_modules\//,
|
|
/node_modules\/@cubone\/react-file-manager/,
|
|
],
|
|
},
|
|
},
|
|
include: [
|
|
'src/index.test.ts',
|
|
'src/routing/activeAppPageRoutes.test.ts',
|
|
'src/routing/activeAppRoutes.test.ts',
|
|
'src/services/activeAppTitle.test.ts',
|
|
'src/services/assetReadUrlService.test.ts',
|
|
'src/services/authService.test.ts',
|
|
'src/services/apiClient.test.ts',
|
|
'src/services/clipboard.test.ts',
|
|
'src/services/host-bridge/**/*.test.ts',
|
|
'src/services/image-editor/**/*.test.ts',
|
|
'src/services/external-generation/**/*.test.ts',
|
|
'src/services/payment/**/*.test.ts',
|
|
'src/services/platform-entry/platformProfileClient.test.ts',
|
|
'src/stores/**/*.test.ts',
|
|
'src/stores/**/*.test.tsx',
|
|
'src/components/auth/**/*.test.ts',
|
|
'src/components/auth/**/*.test.tsx',
|
|
'src/components/creation-home/**/*.test.ts',
|
|
'src/components/creation-home/**/*.test.tsx',
|
|
'src/components/shared-components/**/*.test.tsx',
|
|
'src/components/common/AutoGrowTextArea.test.tsx',
|
|
'src/components/common/CreativeImageInputPanel.test.tsx',
|
|
'src/components/common/PlatformDangerConfirmDialog.test.tsx',
|
|
'src/components/common/PlatformFloatingMenu.test.tsx',
|
|
'src/components/common/PlatformImagePreviewModal.test.tsx',
|
|
'src/components/common/PlatformReportDialog.test.tsx',
|
|
'src/components/common/PlatformUtilityInfoModal.test.tsx',
|
|
'src/components/common/PublishShareModal.test.tsx',
|
|
'src/components/image-editor/**/*.test.ts',
|
|
'src/components/image-editor/**/*.test.tsx',
|
|
'src/components/project/**/*.test.ts',
|
|
'src/components/project/**/*.test.tsx',
|
|
'src/components/platform-entry/PlatformActiveMobileWelcomeDialog.test.tsx',
|
|
'src/components/platform-entry/PlatformActiveProfileView.test.tsx',
|
|
'src/components/platform-entry/PlatformEntryActiveFlowShell.test.tsx',
|
|
'src/components/platform-entry/PlatformProfileModalShell.test.tsx',
|
|
'src/components/platform-entry/PlatformProfileReferralModal.test.tsx',
|
|
'src/components/platform-entry/PlatformProfileRewardCodeRedeemModal.test.tsx',
|
|
'src/components/platform-entry/platformProfile*.test.ts',
|
|
'src/components/platform-entry/usePlatformProfileCenterController*.test.tsx',
|
|
'src/hooks/useHostNavigationCanGoBack.test.tsx',
|
|
'apps/admin-web/src/**/*.test.ts',
|
|
'apps/admin-web/src/**/*.test.tsx',
|
|
'apps/ai-game-creator-shell/tests/**/*.test.ts',
|
|
'apps/ai-game-creator-shell/tests/**/*.test.tsx',
|
|
'miniprogram/**/*.test.js',
|
|
'scripts/**/*.test.ts',
|
|
'packages/shared/src/contracts/hostBridge.test.ts',
|
|
'packages/shared/src/components/**/*.test.ts',
|
|
'packages/shared/src/components/**/*.test.tsx',
|
|
'packages/shared/src/stores/**/*.test.ts',
|
|
'packages/shared/src/utils/**/*.test.ts',
|
|
'packages/image-canvas-core/src/**/*.test.ts',
|
|
'packages/image-canvas-react/src/**/*.test.ts',
|
|
'packages/image-canvas-react/src/**/*.test.tsx',
|
|
'packages/agc-plugin-sdk/src/**/*.test.ts',
|
|
],
|
|
exclude: ['scripts/loadtest/**'],
|
|
},
|
|
});
|