@craft_eco/craft-mcp 0.1.25 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -10
- package/bin/craft-mcp.mjs +10 -8
- package/dist-server/game-workflow/bundle-files.mjs +43 -0
- package/dist-server/game-workflow/engines.mjs +13 -6
- package/dist-server/game-workflow/project-bundles.mjs +90 -0
- package/dist-server/game-workflow/project-context.mjs +91 -0
- package/dist-server/game-workflow/projects.mjs +16 -4
- package/dist-server/game-workflow/publication-materials.mjs +18 -20
- package/dist-server/game-workflow/publications.mjs +15 -17
- package/dist-server/game-workflow/publish-capture.mjs +21 -57
- package/dist-server/integrations/config.mjs +71 -0
- package/dist-server/integrations/files.mjs +54 -0
- package/dist-server/integrations/hosts.mjs +30 -0
- package/dist-server/integrations/install.mjs +86 -0
- package/dist-server/integrations/runtime.mjs +71 -0
- package/dist-server/mcp/publication-page.mjs +18 -50
- package/dist-server/mcp/publish-panel.mjs +28 -35
- package/dist-server/mcp/server.mjs +17 -14
- package/dist-server/preview/preview-launcher.mjs +9 -2
- package/dist-server/preview/preview-start.mjs +2 -2
- package/dist-server/upstream/publication-transport.mjs +19 -19
- package/package.json +10 -2
- package/resources/craft-create/SKILL.md +14 -0
- package/resources/craft-game-maker/SKILL.md +77 -71
- package/resources/craft-game-maker/js.md +10 -10
- package/resources/craft-game-maker/js3d.md +13 -13
- package/resources/game_visual_qa.mjs +1149 -1149
- package/resources/js/bundle.json +93 -0
- package/resources/js/context/AGENTS.md +15 -102
- package/resources/js/context/knowledge/AigcWiring.md +5 -196
- package/resources/js/context/knowledge/AssetUrl.md +5 -20
- package/resources/js/context/knowledge/Layout.md +7 -0
- package/resources/js/context/knowledge/Lifecycle.md +6 -27
- package/resources/js/context/skills/aigc-generate/SKILL.md +6 -141
- package/resources/js/context/skills/asset-search/SKILL.md +5 -62
- package/resources/js/context/skills/asset-search/references/resource-config.md +9 -0
- package/resources/js/context/skills/export-config/SKILL.md +7 -19
- package/resources/js/context/skills/export-config/scripts/export-config.mjs +3 -45
- package/resources/js/context/skills/index.json +30 -0
- package/resources/js/context/skills/visual-qa/SKILL.md +6 -28
- package/resources/js/project/README.md +4 -96
- package/resources/js/project/package.json +1 -2
- package/resources/js/project/scripts/config-export/panel-resource-path.mjs +106 -0
- package/resources/js/{context/skills/export-config/scripts → project/scripts/config-export}/sync-asset-controls.mjs +1 -37
- package/resources/js/project/scripts/config-export.mjs +10 -34
- package/resources/js3d/bundle.json +104 -0
- package/resources/js3d/context/AGENTS.md +16 -85
- package/resources/js3d/context/knowledge/AigcWiring.md +9 -0
- package/resources/js3d/context/knowledge/AssetUrl.md +9 -0
- package/resources/js3d/context/knowledge/CodingGuide/Pitfalls.md +9 -67
- package/resources/js3d/context/knowledge/Layout.md +7 -0
- package/resources/js3d/context/knowledge/Runtime.md +5 -30
- package/resources/js3d/context/skills/aigc-integration/SKILL.md +6 -164
- package/resources/js3d/context/skills/asset-search/SKILL.md +5 -171
- package/resources/js3d/context/skills/asset-search/references/resource-config.md +6 -94
- package/resources/js3d/context/skills/asset-usage-audit/SKILL.md +6 -82
- package/resources/js3d/context/skills/export-config/SKILL.md +7 -11
- package/resources/js3d/context/skills/export-config/scripts/export-config.mjs +3 -55
- package/resources/js3d/context/skills/index.json +42 -0
- package/resources/js3d/context/skills/performance-audit/SKILL.md +8 -153
- package/resources/js3d/context/skills/visual-qa/SKILL.md +14 -0
- package/resources/js3d/project/README.md +4 -103
- package/resources/js3d/project/package.json +1 -2
- package/resources/js3d/project/scripts/config-export/panel-resource-path.mjs +106 -0
- package/resources/js3d/{context/skills/export-config/scripts → project/scripts/config-export}/sync-scene-assets.mjs +3 -28
- package/resources/js3d/project/scripts/config-export.mjs +12 -34
- package/vendor/agent-cli/dist/src/artifacts/build-failure.d.ts +8 -0
- package/vendor/agent-cli/dist/src/artifacts/build-failure.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/artifacts/build-failure.js +39 -0
- package/vendor/agent-cli/dist/src/artifacts/build-failure.js.map +1 -0
- package/vendor/agent-cli/dist/src/artifacts/dependency-toolchain.d.ts +5 -0
- package/vendor/agent-cli/dist/src/artifacts/dependency-toolchain.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/artifacts/dependency-toolchain.js +45 -0
- package/vendor/agent-cli/dist/src/artifacts/dependency-toolchain.js.map +1 -0
- package/vendor/agent-cli/dist/src/artifacts/preinstalled-dependencies.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/preinstalled-dependencies.js +2 -1
- package/vendor/agent-cli/dist/src/artifacts/preinstalled-dependencies.js.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/prepare.d.ts +2 -0
- package/vendor/agent-cli/dist/src/artifacts/prepare.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/prepare.js +7 -2
- package/vendor/agent-cli/dist/src/artifacts/prepare.js.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/process-artifacts.d.ts +2 -0
- package/vendor/agent-cli/dist/src/artifacts/process-artifacts.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/process-artifacts.js +27 -16
- package/vendor/agent-cli/dist/src/artifacts/process-artifacts.js.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-references.d.ts +14 -0
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-references.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-references.js +119 -0
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-references.js.map +1 -0
- package/vendor/agent-cli/dist/src/artifacts/static.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/static.js +20 -6
- package/vendor/agent-cli/dist/src/artifacts/static.js.map +1 -1
- package/vendor/agent-cli/dist/src/cli/process-protocol.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/cli/process-protocol.js +24 -2
- package/vendor/agent-cli/dist/src/cli/process-protocol.js.map +1 -1
- package/vendor/agent-cli/dist/src/cli/process-steering.d.ts +21 -0
- package/vendor/agent-cli/dist/src/cli/process-steering.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/cli/process-steering.js +66 -0
- package/vendor/agent-cli/dist/src/cli/process-steering.js.map +1 -0
- package/vendor/agent-cli/dist/src/context/user-skill-bundle.js +1 -1
- package/vendor/agent-cli/dist/src/context/user-skill-bundle.js.map +1 -1
- package/vendor/agent-cli/dist/src/index.d.ts +4 -1
- package/vendor/agent-cli/dist/src/index.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/index.js +3 -0
- package/vendor/agent-cli/dist/src/index.js.map +1 -1
- package/vendor/agent-cli/dist/src/protocol/messages/messages.gen.d.ts +29 -1
- package/vendor/agent-cli/dist/src/protocol/messages/messages.gen.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/protocol/messages/messages.gen.js +18 -1
- package/vendor/agent-cli/dist/src/protocol/messages/messages.gen.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/client.d.ts +10 -0
- package/vendor/agent-cli/dist/src/session/client.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/client.js +15 -5
- package/vendor/agent-cli/dist/src/session/client.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/link-session.d.ts +3 -0
- package/vendor/agent-cli/dist/src/session/link-session.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/link-session.js +14 -1
- package/vendor/agent-cli/dist/src/session/link-session.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/process-observability.d.ts +3 -0
- package/vendor/agent-cli/dist/src/session/process-observability.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/process-observability.js +11 -0
- package/vendor/agent-cli/dist/src/session/process-observability.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/process-request.d.ts +3 -2
- package/vendor/agent-cli/dist/src/session/process-request.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/process-request.js +27 -9
- package/vendor/agent-cli/dist/src/session/process-request.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/run-start-body.d.ts +1 -0
- package/vendor/agent-cli/dist/src/session/run-start-body.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/run-start-body.js +8 -3
- package/vendor/agent-cli/dist/src/session/run-start-body.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/run-steer.d.ts +42 -0
- package/vendor/agent-cli/dist/src/session/run-steer.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/session/run-steer.js +205 -0
- package/vendor/agent-cli/dist/src/session/run-steer.js.map +1 -0
- package/vendor/agent-cli/dist/src/shared/types.d.ts +6 -0
- package/vendor/agent-cli/dist/src/shared/types.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/tools/context-program-receipt.d.ts +21 -0
- package/vendor/agent-cli/dist/src/tools/context-program-receipt.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/tools/context-program-receipt.js +102 -0
- package/vendor/agent-cli/dist/src/tools/context-program-receipt.js.map +1 -0
- package/vendor/agent-cli/dist/src/tools/context-program.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/tools/context-program.js +3 -0
- package/vendor/agent-cli/dist/src/tools/context-program.js.map +1 -1
- package/resources/js/context/.role/AGENTS_DESIGN.md +0 -9
- package/resources/js/context/agents/aigc-asset.md +0 -168
- package/resources/js/context/knowledge/AigcEnabled.md +0 -49
- package/resources/js/context/knowledge/FrontendComponents.md +0 -17
- package/resources/js/context/knowledge/MobileAdaptation.md +0 -73
- package/resources/js/context/knowledge/MobileAdapted.md +0 -36
- package/resources/js/context/knowledge/Multiplayer/GameplaySystemKnowledge.md +0 -114
- package/resources/js/context/knowledge/Multiplayer/OverviewKnowledge.md +0 -115
- package/resources/js/context/knowledge/Multiplayer/StateSyncKnowledge.md +0 -392
- package/resources/js/context/knowledge/PlatformServices.md +0 -190
- package/resources/js/context/knowledge/ProjectDisplayConfig.md +0 -35
- package/resources/js/context/knowledge/Subsystems/Optional/MultiplayerManagerKnowledge.md +0 -242
- package/resources/js/context/knowledge/Ui.md +0 -11
- package/resources/js/context/knowledge/UiEditorCompat.md +0 -21
- package/resources/js/context/rules/MultiplayerCapability.md +0 -23
- package/resources/js/context/rules/MultiplayerRoomEntryUX.md +0 -63
- package/resources/js/context/rules/PlatformBoundaryModules.md +0 -44
- package/resources/js/context/rules/preview_ready.md +0 -8
- package/resources/js/context/skills/aigc-generate/knowledge/audio.md +0 -39
- package/resources/js/context/skills/aigc-generate/knowledge/batch-replace.md +0 -26
- package/resources/js/context/skills/aigc-generate/knowledge/character2d.md +0 -132
- package/resources/js/context/skills/aigc-generate/knowledge/non-stepwise-aigc.md +0 -53
- package/resources/js/context/skills/aigc-generate/knowledge/texture-prop.md +0 -52
- package/resources/js/context/skills/aigc-generate/knowledge/texture-scene.md +0 -191
- package/resources/js/context/skills/aigc-generate/knowledge/texture-ui.md +0 -55
- package/resources/js/context/skills/asset-search/scripts/asset_display.mjs +0 -62
- package/resources/js/context/skills/asset-search/scripts/config.json +0 -5
- package/resources/js/context/skills/asset-search/scripts/provided_assets.mjs +0 -125
- package/resources/js/context/skills/asset-search/scripts/search.mjs +0 -760
- package/resources/js/context/skills/asset-search/scripts/sprite_source_materializer.mjs +0 -657
- package/resources/js/context/skills/asset-search/strategies/anim2d.md +0 -42
- package/resources/js/context/skills/asset-search/strategies/audio.md +0 -34
- package/resources/js/context/skills/asset-search/strategies/effect2d.md +0 -31
- package/resources/js/context/skills/asset-search/strategies/texture-prop.md +0 -22
- package/resources/js/context/skills/asset-search/strategies/ui-common.md +0 -40
- package/resources/js/context/skills/asset-search/strategies/ui-style.md +0 -28
- package/resources/js/context/skills/export-config/scripts/translate-asset-titles.mjs +0 -161
- package/resources/js/context/skills/lightgame-runtime-adapt/SKILL.md +0 -93
- package/resources/js/context/skills/lightgame-runtime-adapt/project/game-runtime.json +0 -7
- package/resources/js/context/skills/lightgame-runtime-adapt/project/package.json +0 -22
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/identity/qq-ai-game-sdk.min.js +0 -5
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/identity/qq-session.mjs +0 -208
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/identity/shared.mjs +0 -37
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/platform-capture-video.mjs +0 -227
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/platform-service.d.mts +0 -31
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/platform-service.mjs +0 -272
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/platform.d.mts +0 -79
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/platform.mjs +0 -29
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/release.json +0 -22
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tooling/cli.mjs +0 -16
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tooling/project.d.mts +0 -4
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tooling/project.mjs +0 -50
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tooling/vite.d.mts +0 -3
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tooling/vite.mjs +0 -72
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tools/assets.d.mts +0 -24
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tools/assets.mjs +0 -2
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tools/astc.d.mts +0 -10
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tools/astc.mjs +0 -1
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/config-export.mjs +0 -37
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/refresh-runtime.mjs +0 -50
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/cli.mjs +0 -20
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/config.d.mts +0 -19
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/config.mjs +0 -1
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/installed.json +0 -6
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/project.d.mts +0 -6
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/project.mjs +0 -77
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/vite.d.mts +0 -2
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/vite.mjs +0 -34
- package/resources/js/context/skills/lightgame-runtime-adapt/project/src/display/ui-stage.ts +0 -156
- package/resources/js/context/skills/lightgame-runtime-adapt/project/src/display/viewport.ts +0 -249
- package/resources/js/context/skills/lightgame-runtime-adapt/project/src/main.ts +0 -87
- package/resources/js/context/skills/lightgame-runtime-adapt/project/src/platform.ts +0 -2
- package/resources/js/context/skills/lightgame-runtime-adapt/project/src/screenUi.ts +0 -185
- package/resources/js/context/skills/lightgame-runtime-adapt/project/src/style.css +0 -294
- package/resources/js/context/skills/lightgame-runtime-adapt/project/tsconfig.json +0 -20
- package/resources/js/context/skills/lightgame-runtime-adapt/project/vite.config.ts +0 -5
- package/resources/js/context/skills/lightgame-runtime-adapt/scripts/install-template.mjs +0 -159
- package/resources/js/context/skills/mobile-adaptation/SKILL.md +0 -277
- package/resources/js/context/skills/mobile-adaptation/assets/example/src/input/input-config.json +0 -50
- package/resources/js/context/skills/mobile-adaptation/assets/example/src/input/input-layer.ts +0 -862
- package/resources/js/context/skills/mobile-adaptation/assets/example/src/input/input-platform.ts +0 -92
- package/resources/js/context/skills/mobile-adaptation/assets/example/src/input/input-primitives.ts +0 -254
- package/resources/js/context/skills/mobile-adaptation/assets/example/src/input/look-pad.ts +0 -245
- package/resources/js/context/skills/mobile-adaptation/assets/example/src/ui/touch-controls.css +0 -135
- package/resources/js/context/skills/mobile-adaptation/references/input-config.md +0 -342
- package/resources/js/context/skills/mobile-adaptation/references/verification.md +0 -140
- package/resources/js/context/skills/mobile-adaptation/references/web-audio.md +0 -11
- package/resources/js/context/skills/mobile-compat-qa/SKILL.md +0 -53
- package/resources/js/context/skills/mobile-compat-qa/references/startup-diagnosis.md +0 -23
- package/resources/js/context/skills/mobile-compat-qa/references/web-lifecycle.md +0 -20
- package/resources/js/context/skills/mobile-compat-qa/references/web-performance.md +0 -19
- package/resources/js/context/skills/optimization-suggestions/SKILL.md +0 -89
- package/resources/js/context/skills/platform-services/SKILL.md +0 -101
- package/resources/js/context/skills/platform-services/assets/modules/MultiplayerManager.ts +0 -465
- package/resources/js/context/skills/platform-services/assets/modules/eventBus.ts +0 -57
- package/resources/js/context/skills/platform-services/assets/modules/identity/qq-ai-game-sdk.min.js +0 -5
- package/resources/js/context/skills/platform-services/assets/modules/identity/qq-session.mjs +0 -208
- package/resources/js/context/skills/platform-services/assets/modules/identity/shared.mjs +0 -37
- package/resources/js/context/skills/platform-services/assets/modules/leaderboard.d.mts +0 -39
- package/resources/js/context/skills/platform-services/assets/modules/leaderboard.mjs +0 -1
- package/resources/js/context/skills/platform-services/assets/modules/log.ts +0 -35
- package/resources/js/context/skills/platform-services/assets/modules/multiplayer/clockSync.ts +0 -61
- package/resources/js/context/skills/platform-services/assets/modules/multiplayer/dsClient.ts +0 -52
- package/resources/js/context/skills/platform-services/assets/modules/multiplayer/payloadCodec.ts +0 -30
- package/resources/js/context/skills/platform-services/assets/modules/multiplayer/roomHttp.ts +0 -89
- package/resources/js/context/skills/platform-services/assets/modules/multiplayer/types.ts +0 -47
- package/resources/js/context/skills/platform-services/assets/modules/platform-service.d.mts +0 -31
- package/resources/js/context/skills/platform-services/assets/modules/platform-service.mjs +0 -272
- package/resources/js/context/skills/platform-services/assets/modules/save.d.mts +0 -49
- package/resources/js/context/skills/platform-services/assets/modules/save.mjs +0 -1
- package/resources/js/context/skills/platform-services/assets/scaffold/ds/main.mjs +0 -7
- package/resources/js/context/skills/platform-services/assets/scaffold/ds/rooms/SyncRoom.mjs +0 -264
- package/resources/js/context/skills/platform-services/assets/scaffold/ds/rooms/syncSchema.mjs +0 -39
- package/resources/js/context/skills/platform-services/references/SERVER_GUIDE.md +0 -139
- package/resources/js/context/skills/platform-services/references/api_reference.md +0 -18
- package/resources/js/context/skills/platform-services/references/leaderboard_playbook.md +0 -96
- package/resources/js/context/skills/platform-services/scripts/install.mjs +0 -148
- package/resources/js/context/skills/resolution-adaptation/SKILL.md +0 -47
- package/resources/js/context/skills/resolution-adaptation/assets/display/ui-stage.ts +0 -156
- package/resources/js/context/skills/resolution-adaptation/assets/display/viewport.ts +0 -249
- package/resources/js/context/skills/resolution-adaptation/assets/example/main.ts +0 -98
- package/resources/js/context/skills/resolution-adaptation/assets/example/ui-tokens.css +0 -200
- package/resources/js/context/skills/resolution-adaptation/references/audit.md +0 -31
- package/resources/js/context/skills/resolution-adaptation/references/device-safe-area.md +0 -40
- package/resources/js/context/skills/resolution-adaptation/references/game-ui-occlusion.md +0 -18
- package/resources/js/context/skills/resolution-adaptation/references/layout-rules.md +0 -15
- package/resources/js/context/skills/resolution-adaptation/references/troubleshooting.md +0 -34
- package/resources/js/context/skills/resolution-adaptation/references/viewport-api.md +0 -38
- package/resources/js/context/skills/resolution-adaptation/references/world-resize.md +0 -55
- package/resources/js/context/skills/resolution-adaptation/scripts/aspect_audit.mjs +0 -448
- package/resources/js/context/skills/scene-editor-compat/SKILL.md +0 -94
- package/resources/js/context/skills/scene-editor-compat/assets/example/localcraft.assets.json +0 -13
- package/resources/js/context/skills/scene-editor-compat/assets/example/localcraft.scene-editor.json +0 -6
- package/resources/js/context/skills/scene-editor-compat/assets/example/src/game/sceneAdapter.ts +0 -25
- package/resources/js/context/skills/scene-editor-compat/assets/example/src/scenes/main.scene.json +0 -18
- package/resources/js/context/skills/scene-editor-compat/assets/runtime/release.json +0 -7
- package/resources/js/context/skills/scene-editor-compat/assets/runtime/scene.d.mts +0 -42
- package/resources/js/context/skills/scene-editor-compat/assets/runtime/scene.mjs +0 -144
- package/resources/js/context/skills/scene-editor-compat/docs/contract.md +0 -330
- package/resources/js/context/skills/scene-editor-compat/docs/resource-sync.md +0 -64
- package/resources/js/context/skills/scene-editor-compat/docs/runtime-state.md +0 -28
- package/resources/js/context/skills/scene-editor-compat/docs/terrain-contract.md +0 -47
- package/resources/js/context/skills/scene-editor-compat/docs/visual-contract.md +0 -64
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/localcraft.assets.json +0 -38
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/localcraft.scene-editor.json +0 -9
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/src/game/sceneAdapter.ts +0 -59
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/src/game/sceneBlockers.ts +0 -30
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/src/game/sceneFileAssets.ts +0 -66
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/src/scenes/Main.Scene.ts +0 -20
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/src/scenes/SceneTypes.ts +0 -26
- package/resources/js/context/skills/scene-editor-compat/references/contract.md +0 -73
- package/resources/js/context/skills/scene-editor-compat/scripts/apply_scene_marker.py +0 -162
- package/resources/js/context/skills/scene-editor-compat/scripts/check_scene_contract.py +0 -853
- package/resources/js/context/skills/scene-editor-compat/scripts/check_scene_resource_urls.py +0 -173
- package/resources/js/context/skills/scene-editor-compat/scripts/scene-editor.mjs +0 -427
- package/resources/js/context/skills/scene-editor-compat/version.json +0 -1
- package/resources/js/context/skills/ui-editor-compat/SKILL.md +0 -48
- package/resources/js/context/skills/ui-editor-compat/assets/example/hud/WidgetLayout_Hud.ts +0 -35
- package/resources/js/context/skills/ui-editor-compat/assets/example/hud/WidgetLogic_Hud.ts +0 -74
- package/resources/js/context/skills/ui-editor-compat/assets/example/hud/hud.css +0 -60
- package/resources/js/context/skills/ui-editor-compat/assets/runtime/dom-ui.d.mts +0 -45
- package/resources/js/context/skills/ui-editor-compat/assets/runtime/dom-ui.mjs +0 -265
- package/resources/js/context/skills/ui-editor-compat/assets/runtime/release.json +0 -7
- package/resources/js/context/skills/ui-editor-compat/references/contract.md +0 -132
- package/resources/js/context/skills/ui-editor-compat/scripts/editor-contract.mjs +0 -327
- package/resources/js/context/skills/ui-editor-compat/scripts/project-files.mjs +0 -80
- package/resources/js/context/skills/ui-editor-compat/scripts/ui-editor.mjs +0 -84
- package/resources/js/context/skills/version-update/SKILL.md +0 -192
- package/resources/js/context/skills/version-update/scripts/check_runtime_refs.mjs +0 -129
- package/resources/js/context/skills/version-update/scripts/feature_snapshot.mjs +0 -159
- package/resources/js/context/skills/version-update/scripts/update_feature_version.mjs +0 -157
- package/resources/js/context/skills/version-update/upgrade_diffs/.gitkeep +0 -0
- package/resources/js/context/version/version.json +0 -1
- package/resources/js/project/SPEC/assist/.gitkeep +0 -0
- package/resources/js/project/SPEC/guide/.gitkeep +0 -0
- package/resources/js/project/SPEC/plan/.gitkeep +0 -0
- package/resources/js/project/SPEC/readme.md +0 -6
- package/resources/js/project/SPEC/res/.gitkeep +0 -0
- package/resources/js/project/SPEC/task-item/.gitkeep +0 -0
- package/resources/js/project/runtime/lightgame/1.0.0/platform/config.d.mts +0 -19
- package/resources/js/project/runtime/lightgame/1.0.0/platform/config.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/platform/leaderboard.d.mts +0 -39
- package/resources/js/project/runtime/lightgame/1.0.0/platform/leaderboard.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/platform/platform-capture-video.mjs +0 -227
- package/resources/js/project/runtime/lightgame/1.0.0/platform/platform-service.d.mts +0 -25
- package/resources/js/project/runtime/lightgame/1.0.0/platform/platform-service.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/platform/platform.d.mts +0 -79
- package/resources/js/project/runtime/lightgame/1.0.0/platform/platform.mjs +0 -29
- package/resources/js/project/runtime/lightgame/1.0.0/platform/save.d.mts +0 -49
- package/resources/js/project/runtime/lightgame/1.0.0/platform/save.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/release.json +0 -37
- package/resources/js/project/runtime/lightgame/1.0.0/tooling/cli.mjs +0 -2
- package/resources/js/project/runtime/lightgame/1.0.0/tooling/project.d.mts +0 -8
- package/resources/js/project/runtime/lightgame/1.0.0/tooling/project.mjs +0 -2
- package/resources/js/project/runtime/lightgame/1.0.0/tooling/vite.d.mts +0 -3
- package/resources/js/project/runtime/lightgame/1.0.0/tooling/vite.mjs +0 -8
- package/resources/js/project/runtime/lightgame/1.0.0/tools/assets.d.mts +0 -24
- package/resources/js/project/runtime/lightgame/1.0.0/tools/assets.mjs +0 -2
- package/resources/js/project/runtime/lightgame/1.0.0/tools/astc.d.mts +0 -10
- package/resources/js/project/runtime/lightgame/1.0.0/tools/astc.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/tools/audio.d.mts +0 -20
- package/resources/js/project/runtime/lightgame/1.0.0/tools/audio.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/tools/canvas.d.mts +0 -21
- package/resources/js/project/runtime/lightgame/1.0.0/tools/canvas.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/tools/input.d.mts +0 -17
- package/resources/js/project/runtime/lightgame/1.0.0/tools/input.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/tools/three.d.mts +0 -40
- package/resources/js/project/runtime/lightgame/1.0.0/tools/three.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/tools/ui.d.mts +0 -10
- package/resources/js/project/runtime/lightgame/1.0.0/tools/ui.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/tools/video.d.mts +0 -8
- package/resources/js/project/runtime/lightgame/1.0.0/tools/video.mjs +0 -1
- package/resources/js/project/scripts/refresh-runtime.mjs +0 -50
- package/resources/js/project/vendor/core-manager-js/package.json +0 -33
- package/resources/js/project/vendor/core-manager-js/src/.versions.json +0 -42
- package/resources/js/project/vendor/core-manager-js/src/CoreManagerPlugin.ts +0 -41
- package/resources/js/project/vendor/core-manager-js/src/assetManager/AssetRef.ts +0 -93
- package/resources/js/project/vendor/core-manager-js/src/assetManager/AstcFirstImageFile.ts +0 -203
- package/resources/js/project/vendor/core-manager-js/src/assetManager/AstcTextureLoader.ts +0 -106
- package/resources/js/project/vendor/core-manager-js/src/assetManager/resolveAssetUrl.test.ts +0 -25
- package/resources/js/project/vendor/core-manager-js/src/assetManager/resolveAssetUrl.ts +0 -21
- package/resources/js/project/vendor/core-manager-js/src/audioManager/AudioManager.test.ts +0 -65
- package/resources/js/project/vendor/core-manager-js/src/audioManager/AudioManager.ts +0 -340
- package/resources/js/project/vendor/core-manager-js/src/configManager/FeatureConfig.ts +0 -87
- package/resources/js/project/vendor/core-manager-js/src/configManager/tuneRuntime.d.mts +0 -92
- package/resources/js/project/vendor/core-manager-js/src/configManager/tuneRuntime.mjs +0 -271
- package/resources/js/project/vendor/core-manager-js/src/index.ts +0 -31
- package/resources/js/project/vendor/core-manager-js/src/inputManager/InputConfig.ts +0 -81
- package/resources/js/project/vendor/core-manager-js/src/inputManager/InputManager.test.ts +0 -43
- package/resources/js/project/vendor/core-manager-js/src/inputManager/InputManager.ts +0 -32
- package/resources/js/project/vendor/core-manager-js/src/inputManager/InputRuntime.test.ts +0 -141
- package/resources/js/project/vendor/core-manager-js/src/inputManager/InputRuntime.ts +0 -20
- package/resources/js/project/vendor/core-manager-js/src/inputManager/KeyboardProvider.ts +0 -183
- package/resources/js/project/vendor/core-manager-js/src/inputManager/TouchProvider.ts +0 -304
- package/resources/js/project/vendor/core-manager-js/src/inputManager/VirtualJoystick.ts +0 -351
- package/resources/js/project/vendor/core-manager-js/src/inputManager/_internal/InputManagerImpl.ts +0 -180
- package/resources/js/project/vendor/core-manager-js/src/inputManager/icons.b64 +0 -13
- package/resources/js/project/vendor/core-manager-js/src/inputManager/icons.b64.d.ts +0 -14
- package/resources/js/project/vendor/core-manager-js/src/inputManager/input_config.example.json +0 -68
- package/resources/js/project/vendor/core-manager-js/src/logManager/DebugConsole.ts +0 -433
- package/resources/js/project/vendor/core-manager-js/src/logManager/LogCapture.ts +0 -118
- package/resources/js/project/vendor/core-manager-js/src/logManager/LogManager.ts +0 -444
- package/resources/js/project/vendor/core-manager-js/src/logManager/ScreenCapture.ts +0 -485
- package/resources/js/project/vendor/core-manager-js/src/logManager/ScreenCaptureVideo.test.ts +0 -66
- package/resources/js/project/vendor/core-manager-js/src/logManager/ScreenCaptureVideo.ts +0 -149
- package/resources/js/project/vendor/core-manager-js/src/logManager/icons.b64 +0 -9
- package/resources/js/project/vendor/core-manager-js/src/resourceManager/AssetUrlResolver.ts +0 -29
- package/resources/js/project/vendor/core-manager-js/src/resourceManager/ResourceManager.test.ts +0 -88
- package/resources/js/project/vendor/core-manager-js/src/resourceManager/ResourceManager.ts +0 -122
- package/resources/js/project/vendor/core-manager-js/src/runtime.ts +0 -24
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/CharacterEntity.ts +0 -318
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/CharacterPhysicsBinding.test.ts +0 -151
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/CharacterPhysicsBinding.ts +0 -235
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/EffectComposite.test.ts +0 -98
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/EffectComposite.ts +0 -94
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/EffectEntity.ts +0 -209
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/FxManager.test.ts +0 -106
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/FxManager.ts +0 -341
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/FxRecipe.test.ts +0 -68
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/FxRecipe.ts +0 -236
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/SpriteAnimManager.test.ts +0 -22
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/SpriteAnimManager.ts +0 -29
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/SpriteEntity.test.ts +0 -197
- package/resources/js/project/vendor/core-manager-js/src/uiManager/DomUiContracts.ts +0 -9
- package/resources/js/project/vendor/core-manager-js/src/uiManager/DomUiKit.ts +0 -555
- package/resources/js/project/vendor/core-manager-js/src/uiManager/UIFacadePlugin.test.ts +0 -112
- package/resources/js/project/vendor/core-manager-js/src/uiManager/UIFacadePlugin.ts +0 -178
- package/resources/js/project/vendor/core-manager-js/src/uiManager/ui-base.css +0 -246
- package/resources/js/project/vendor/core-manager-js/src/videoManager/VideoManager.ts +0 -139
- package/resources/js/project/vendor/core-manager-js/tsconfig.json +0 -15
- package/resources/js/project/vendor/run.sh +0 -4
- package/resources/js/project/version/craft_feature_version.json +0 -42
- package/resources/js/project/version/project_feature_version.json +0 -11
- package/resources/js3d/context/.role/AGENTS_DESIGN.md +0 -9
- package/resources/js3d/context/knowledge/3D/PoseInterpolationKnowledge.md +0 -75
- package/resources/js3d/context/knowledge/CodingGuide/SceneEditableGuide.md +0 -42
- package/resources/js3d/context/knowledge/FrontendComponents.md +0 -19
- package/resources/js3d/context/knowledge/MobileAdaptation.md +0 -73
- package/resources/js3d/context/knowledge/MobileAdapted.md +0 -36
- package/resources/js3d/context/knowledge/Multiplayer/GameplaySystemKnowledge.md +0 -114
- package/resources/js3d/context/knowledge/Multiplayer/OverviewKnowledge.md +0 -117
- package/resources/js3d/context/knowledge/Multiplayer/StateSyncKnowledge.md +0 -430
- package/resources/js3d/context/knowledge/PlatformServices.md +0 -190
- package/resources/js3d/context/knowledge/ProjectDisplayConfig.md +0 -35
- package/resources/js3d/context/knowledge/SceneEditorCompat.md +0 -35
- package/resources/js3d/context/knowledge/StepByStep.md +0 -21
- package/resources/js3d/context/knowledge/Subsystems/Optional/MultiplayerManagerKnowledge.md +0 -242
- package/resources/js3d/context/knowledge/UiEditorCompat.md +0 -21
- package/resources/js3d/context/rules/MultiplayerCapability.md +0 -27
- package/resources/js3d/context/rules/MultiplayerRoomEntryUX.md +0 -63
- package/resources/js3d/context/rules/PlatformBoundaryModules.md +0 -44
- package/resources/js3d/context/rules/preview_ready.md +0 -8
- package/resources/js3d/context/skills/aigc-integration/assets/sprite-sheet-player.mjs +0 -70
- package/resources/js3d/context/skills/aigc-integration/callback.md +0 -77
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/README.md +0 -23
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/audio-aigc-knowledge.md +0 -38
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/character2d-aigc-knowledge.md +0 -72
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/staticmesh-aigc-knowledge.md +0 -33
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/texture-prop-aigc-knowledge.md +0 -36
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/texture-scene-aigc-knowledge.md +0 -37
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/texture-ui-aigc-knowledge.md +0 -35
- package/resources/js3d/context/skills/asset-search/references/sprite-sheets.md +0 -58
- package/resources/js3d/context/skills/asset-search/scripts/asset_display.mjs +0 -62
- package/resources/js3d/context/skills/asset-search/scripts/config.json +0 -235
- package/resources/js3d/context/skills/asset-search/scripts/manifest_pipeline.mjs +0 -905
- package/resources/js3d/context/skills/asset-search/scripts/preflight.mjs +0 -79
- package/resources/js3d/context/skills/asset-search/scripts/provided_assets.mjs +0 -74
- package/resources/js3d/context/skills/asset-search/scripts/search.mjs +0 -637
- package/resources/js3d/context/skills/asset-search/scripts/sprite_source_materializer.mjs +0 -667
- package/resources/js3d/context/skills/asset-search/strategies/anim2d.md +0 -42
- package/resources/js3d/context/skills/asset-search/strategies/effect2d.md +0 -31
- package/resources/js3d/context/skills/asset-usage-audit/references/case-tidewater-zoo.md +0 -89
- package/resources/js3d/context/skills/asset-usage-audit/references/optimization-playbook.md +0 -143
- package/resources/js3d/context/skills/asset-usage-audit/references/usage-model.md +0 -90
- package/resources/js3d/context/skills/export-config/scripts/translate-asset-titles.mjs +0 -161
- package/resources/js3d/context/skills/game-art-style/SKILL.md +0 -60
- package/resources/js3d/context/skills/game-art-style/assets/previews/cartoon.png +0 -0
- package/resources/js3d/context/skills/game-art-style/assets/previews/comic.png +0 -0
- package/resources/js3d/context/skills/game-art-style/assets/previews/cozy.png +0 -0
- package/resources/js3d/context/skills/game-art-style/assets/previews/cyber.png +0 -0
- package/resources/js3d/context/skills/game-art-style/assets/previews/horror.png +0 -0
- package/resources/js3d/context/skills/game-art-style/assets/previews/lowpoly.png +0 -0
- package/resources/js3d/context/skills/game-art-style/assets/previews/paper.png +0 -0
- package/resources/js3d/context/skills/game-art-style/assets/previews/voxel.png +0 -0
- package/resources/js3d/context/skills/game-art-style/references/art-parameters-lite.md +0 -38
- package/resources/js3d/context/skills/game-art-style/references/construction.md +0 -111
- package/resources/js3d/context/skills/game-art-style/references/materials-textures.md +0 -105
- package/resources/js3d/context/skills/game-art-style/references/sources.md +0 -25
- package/resources/js3d/context/skills/game-art-style/references/styles/cartoon.md +0 -175
- package/resources/js3d/context/skills/game-art-style/references/styles/comic.md +0 -168
- package/resources/js3d/context/skills/game-art-style/references/styles/cozy.md +0 -191
- package/resources/js3d/context/skills/game-art-style/references/styles/cyber.md +0 -165
- package/resources/js3d/context/skills/game-art-style/references/styles/horror.md +0 -173
- package/resources/js3d/context/skills/game-art-style/references/styles/lowpoly.md +0 -185
- package/resources/js3d/context/skills/game-art-style/references/styles/paper.md +0 -181
- package/resources/js3d/context/skills/game-art-style/references/styles/voxel.md +0 -189
- package/resources/js3d/context/skills/game-art-style/references/user-style-document.md +0 -88
- package/resources/js3d/context/skills/mobile-adaptation/SKILL.md +0 -301
- package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/input/input-config.json +0 -104
- package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/input/input-layer.ts +0 -933
- package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/input/input-platform.ts +0 -92
- package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/input/input-primitives.ts +0 -254
- package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/input/look-pad.ts +0 -245
- package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/ui/touch-controls.css +0 -257
- package/resources/js3d/context/skills/mobile-adaptation/references/input-config.md +0 -342
- package/resources/js3d/context/skills/mobile-adaptation/references/verification.md +0 -140
- package/resources/js3d/context/skills/mobile-adaptation/references/web-audio.md +0 -11
- package/resources/js3d/context/skills/mobile-compat-qa/SKILL.md +0 -53
- package/resources/js3d/context/skills/mobile-compat-qa/references/startup-diagnosis.md +0 -23
- package/resources/js3d/context/skills/mobile-compat-qa/references/web-form-input.md +0 -10
- package/resources/js3d/context/skills/mobile-compat-qa/references/web-lifecycle.md +0 -20
- package/resources/js3d/context/skills/mobile-compat-qa/references/web-performance.md +0 -19
- package/resources/js3d/context/skills/optimization-suggestions/SKILL.md +0 -74
- package/resources/js3d/context/skills/performance-audit/references/case-notes.md +0 -93
- package/resources/js3d/context/skills/performance-audit/references/rules.md +0 -183
- package/resources/js3d/context/skills/platform-services/SKILL.md +0 -101
- package/resources/js3d/context/skills/platform-services/assets/modules/MultiplayerManager.ts +0 -465
- package/resources/js3d/context/skills/platform-services/assets/modules/eventBus.ts +0 -57
- package/resources/js3d/context/skills/platform-services/assets/modules/identity/qq-ai-game-sdk.min.js +0 -5
- package/resources/js3d/context/skills/platform-services/assets/modules/identity/qq-session.mjs +0 -208
- package/resources/js3d/context/skills/platform-services/assets/modules/identity/shared.mjs +0 -37
- package/resources/js3d/context/skills/platform-services/assets/modules/leaderboard.d.mts +0 -39
- package/resources/js3d/context/skills/platform-services/assets/modules/leaderboard.mjs +0 -1
- package/resources/js3d/context/skills/platform-services/assets/modules/log.ts +0 -35
- package/resources/js3d/context/skills/platform-services/assets/modules/multiplayer/clockSync.ts +0 -61
- package/resources/js3d/context/skills/platform-services/assets/modules/multiplayer/dsClient.ts +0 -52
- package/resources/js3d/context/skills/platform-services/assets/modules/multiplayer/payloadCodec.ts +0 -30
- package/resources/js3d/context/skills/platform-services/assets/modules/multiplayer/roomHttp.ts +0 -89
- package/resources/js3d/context/skills/platform-services/assets/modules/multiplayer/types.ts +0 -47
- package/resources/js3d/context/skills/platform-services/assets/modules/platform-service.d.mts +0 -31
- package/resources/js3d/context/skills/platform-services/assets/modules/platform-service.mjs +0 -272
- package/resources/js3d/context/skills/platform-services/assets/modules/save.d.mts +0 -49
- package/resources/js3d/context/skills/platform-services/assets/modules/save.mjs +0 -1
- package/resources/js3d/context/skills/platform-services/assets/scaffold/ds/main.mjs +0 -7
- package/resources/js3d/context/skills/platform-services/assets/scaffold/ds/rooms/SyncRoom.mjs +0 -264
- package/resources/js3d/context/skills/platform-services/assets/scaffold/ds/rooms/syncSchema.mjs +0 -39
- package/resources/js3d/context/skills/platform-services/references/SERVER_GUIDE.md +0 -139
- package/resources/js3d/context/skills/platform-services/references/api_reference.md +0 -18
- package/resources/js3d/context/skills/platform-services/references/leaderboard_playbook.md +0 -96
- package/resources/js3d/context/skills/platform-services/scripts/install.mjs +0 -148
- package/resources/js3d/context/skills/resolution-adaptation/SKILL.md +0 -46
- package/resources/js3d/context/skills/resolution-adaptation/assets/display/ui-stage.ts +0 -156
- package/resources/js3d/context/skills/resolution-adaptation/assets/display/viewport.ts +0 -239
- package/resources/js3d/context/skills/resolution-adaptation/assets/example/main.ts +0 -129
- package/resources/js3d/context/skills/resolution-adaptation/assets/example/ui-tokens.css +0 -188
- package/resources/js3d/context/skills/resolution-adaptation/references/audit.md +0 -31
- package/resources/js3d/context/skills/resolution-adaptation/references/device-safe-area.md +0 -40
- package/resources/js3d/context/skills/resolution-adaptation/references/game-ui-occlusion.md +0 -18
- package/resources/js3d/context/skills/resolution-adaptation/references/layout-rules.md +0 -15
- package/resources/js3d/context/skills/resolution-adaptation/references/troubleshooting.md +0 -34
- package/resources/js3d/context/skills/resolution-adaptation/references/viewport-api.md +0 -38
- package/resources/js3d/context/skills/resolution-adaptation/scripts/aspect_audit.mjs +0 -448
- package/resources/js3d/context/skills/scene-editor-compat/SKILL.md +0 -599
- package/resources/js3d/context/skills/scene-editor-compat/references/bundle-contract.md +0 -141
- package/resources/js3d/context/skills/scene-editor-compat/references/editor-integration.md +0 -92
- package/resources/js3d/context/skills/scene-editor-compat/references/scene-data-format.md +0 -125
- package/resources/js3d/context/skills/scene-editor-compat/references/slots-rules.md +0 -113
- package/resources/js3d/context/skills/scene-editor-compat/scripts/scene-editor.mjs +0 -1187
- package/resources/js3d/context/skills/threejs-game-quality/SKILL.md +0 -53
- package/resources/js3d/context/skills/threejs-game-quality/agents/openai.yaml +0 -4
- package/resources/js3d/context/skills/threejs-game-quality/references/01-build.md +0 -94
- package/resources/js3d/context/skills/threejs-game-quality/references/02-avoid.md +0 -50
- package/resources/js3d/context/skills/threejs-game-quality/references/03-detect.md +0 -105
- package/resources/js3d/context/skills/threejs-game-quality/references/camera-by-genre.md +0 -147
- package/resources/js3d/context/skills/threejs-game-quality/references/camera-distance.md +0 -79
- package/resources/js3d/context/skills/threejs-game-quality/references/camera-sources.md +0 -56
- package/resources/js3d/context/skills/threejs-game-quality/references/character-motion-face.md +0 -51
- package/resources/js3d/context/skills/threejs-game-quality/references/parameter-contract.md +0 -55
- package/resources/js3d/context/skills/threejs-game-quality/references/refine-existing.md +0 -78
- package/resources/js3d/context/skills/threejs-game-quality/references/rendering-stability.md +0 -84
- package/resources/js3d/context/skills/threejs-game-quality/references/runtime-tools.md +0 -120
- package/resources/js3d/context/skills/threejs-game-quality/scripts/package.json +0 -4
- package/resources/js3d/context/skills/threejs-game-quality/scripts/runtime-audit.js +0 -238
- package/resources/js3d/context/skills/ui-editor-compat/SKILL.md +0 -59
- package/resources/js3d/context/skills/ui-editor-compat/assets/example/hud/WidgetLayout_Hud.ts +0 -35
- package/resources/js3d/context/skills/ui-editor-compat/assets/example/hud/WidgetLogic_Hud.ts +0 -61
- package/resources/js3d/context/skills/ui-editor-compat/assets/example/hud/hud.css +0 -60
- package/resources/js3d/context/skills/ui-editor-compat/assets/runtime/dom-ui.d.mts +0 -45
- package/resources/js3d/context/skills/ui-editor-compat/assets/runtime/dom-ui.mjs +0 -265
- package/resources/js3d/context/skills/ui-editor-compat/assets/runtime/release.json +0 -7
- package/resources/js3d/context/skills/ui-editor-compat/references/contract.md +0 -110
- package/resources/js3d/context/skills/ui-editor-compat/scripts/editor-contract.mjs +0 -327
- package/resources/js3d/context/skills/ui-editor-compat/scripts/project-files.mjs +0 -80
- package/resources/js3d/context/skills/ui-editor-compat/scripts/ui-editor.mjs +0 -84
- package/resources/js3d/context/skills/version-update/SKILL.md +0 -191
- package/resources/js3d/context/skills/version-update/scripts/check_runtime_refs.mjs +0 -129
- package/resources/js3d/context/skills/version-update/scripts/feature_snapshot.mjs +0 -159
- package/resources/js3d/context/skills/version-update/scripts/update_feature_version.mjs +0 -157
- package/resources/js3d/context/skills/version-update/upgrade_diffs/.gitkeep +0 -0
- package/resources/js3d/context/version/version.json +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/config.d.mts +0 -19
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/config.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/leaderboard.d.mts +0 -39
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/leaderboard.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/platform-capture-video.mjs +0 -227
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/platform-service.d.mts +0 -25
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/platform-service.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/platform.d.mts +0 -79
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/platform.mjs +0 -30
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/save.d.mts +0 -49
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/save.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/release.json +0 -39
- package/resources/js3d/project/runtime/lightgame/1.0.0/tooling/cli.mjs +0 -2
- package/resources/js3d/project/runtime/lightgame/1.0.0/tooling/project.d.mts +0 -8
- package/resources/js3d/project/runtime/lightgame/1.0.0/tooling/project.mjs +0 -2
- package/resources/js3d/project/runtime/lightgame/1.0.0/tooling/vite.d.mts +0 -3
- package/resources/js3d/project/runtime/lightgame/1.0.0/tooling/vite.mjs +0 -7
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/assets.d.mts +0 -24
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/assets.mjs +0 -2
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/astc.d.mts +0 -10
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/astc.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/audio.d.mts +0 -20
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/audio.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/canvas.d.mts +0 -21
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/canvas.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/glb.d.mts +0 -26
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/glb.mjs +0 -351
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/input.d.mts +0 -17
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/input.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/three.d.mts +0 -40
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/three.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/ui.d.mts +0 -10
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/ui.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/video.d.mts +0 -8
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/video.mjs +0 -1
- package/resources/js3d/project/scripts/refresh-runtime.mjs +0 -50
- package/resources/js3d/project/vendor/core-manager-three/package.json +0 -12
- package/resources/js3d/project/vendor/core-manager-three/src/index.ts +0 -2
- package/resources/js3d/project/vendor/run.sh +0 -4
- package/resources/js3d/project/version/craft_feature_version.json +0 -42
- package/resources/js3d/project/version/project_feature_version.json +0 -11
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-delivery.d.ts +0 -7
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-delivery.d.ts.map +0 -1
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-delivery.js +0 -145
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-delivery.js.map +0 -1
- /package/resources/js/{context/skills/export-config/scripts → project/scripts/config-export}/assert-asset-wiring.mjs +0 -0
- /package/resources/js3d/{context/skills/export-config/scripts → project/scripts/config-export}/assert-asset-wiring.mjs +0 -0
- /package/resources/js3d/{context/skills/export-config/scripts → project/scripts/config-export}/sync-asset-controls.mjs +0 -0
|
@@ -1,1187 +0,0 @@
|
|
|
1
|
-
import { readFile, writeFile, mkdir, rename, unlink, lstat, readdir, stat } from 'node:fs/promises';
|
|
2
|
-
import { createRequire } from 'node:module';
|
|
3
|
-
import { dirname, resolve, relative, isAbsolute, join } from 'node:path';
|
|
4
|
-
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
5
|
-
import { checkFeatureVersion, updateFeatureVersion } from '../../version-update/scripts/update_feature_version.mjs';
|
|
6
|
-
import { randomUUID } from 'node:crypto';
|
|
7
|
-
|
|
8
|
-
const MARKER = 'scene_editor_compat';
|
|
9
|
-
const SCENE_MARKER = 'scene_editor_scene';
|
|
10
|
-
const SCENES_MARKER = 'scene_editor_scenes';
|
|
11
|
-
const DISPLAY_FILE = 'projectDisplayInfo.json';
|
|
12
|
-
const BUNDLE_FILE = 'slots.preview.js';
|
|
13
|
-
const SCENES_DIR = 'src/scenes';
|
|
14
|
-
/** 装配侧的「包载体」写法:创建载体变量并在附近把造型结果 add 进去(见 checkAssemblyParity)。
|
|
15
|
-
* 用标识符回引而不是「出现过 new Group()」,避免装配文件里无关的 Group 把判据压住。 */
|
|
16
|
-
const CARRIER_MOUNT = /(?:const|let|var)\s+(\w+)\s*=\s*new\s+(?:THREE\.)?(?:Group|Object3D)\s*\(\s*\)[\s\S]{0,400}?\b\1\.add\s*\(/;
|
|
17
|
-
|
|
18
|
-
/** 拒绝链接与越界路径,脚本只读写项目内文件。 */
|
|
19
|
-
async function projectFile(project, path = '') {
|
|
20
|
-
const root = resolve(project);
|
|
21
|
-
const target = resolve(root, path);
|
|
22
|
-
const rel = relative(root, target);
|
|
23
|
-
if (rel === '..' || rel.startsWith('../') || rel.startsWith('..\\') || isAbsolute(rel)) {
|
|
24
|
-
throw new Error(`路径越出项目目录: ${path}`);
|
|
25
|
-
}
|
|
26
|
-
let current = target;
|
|
27
|
-
for (;;) {
|
|
28
|
-
try {
|
|
29
|
-
const info = await lstat(current);
|
|
30
|
-
if (info.isSymbolicLink()) throw new Error(`项目路径不得经过符号链接: ${current}`);
|
|
31
|
-
if (current !== target && !info.isDirectory()) throw new Error(`不是目录: ${current}`);
|
|
32
|
-
} catch (error) { if (error.code !== 'ENOENT') throw error; }
|
|
33
|
-
const parent = dirname(current);
|
|
34
|
-
if (parent === current) break;
|
|
35
|
-
current = parent;
|
|
36
|
-
}
|
|
37
|
-
return target;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
async function readJsonFile(path) {
|
|
41
|
-
try { return JSON.parse(await readFile(path, 'utf8')); }
|
|
42
|
-
catch (error) { throw new Error(`${path}: ${error.message}`, { cause: error }); }
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
async function statOrNull(path) {
|
|
46
|
-
try { return await stat(path); } catch (error) { if (error.code === 'ENOENT') return null; throw error; }
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function toPosix(value) { return value.replaceAll('\\', '/'); }
|
|
50
|
-
|
|
51
|
-
/** 打印 SKILL.md frontmatter 的约束修订号。功能版本不写在这里,
|
|
52
|
-
* 由 mark 按 craft_feature_version.json 写入 project_feature_version.json。 */
|
|
53
|
-
async function readSkillVersion() {
|
|
54
|
-
const path = resolve(dirname(fileURLToPath(import.meta.url)), '..', 'SKILL.md');
|
|
55
|
-
const text = await readFile(path, 'utf8').catch(() => null);
|
|
56
|
-
const front = text && /^---\r?\n([\s\S]*?)\r?\n---/.exec(text);
|
|
57
|
-
const line = front && /^version\s*:\s*(\S+)\s*$/m.exec(front[1]);
|
|
58
|
-
return line ? line[1] : null;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/* ------------------------------------------------------------------ *
|
|
62
|
-
* scene.ts 解析(与编辑器 parseSceneSource 同构:正则定位 + 括号配对 + 求值)
|
|
63
|
-
* ------------------------------------------------------------------ */
|
|
64
|
-
|
|
65
|
-
const EXPORT_RE = /export\s+const\s+scene\s*:\s*SceneData\s*=/g;
|
|
66
|
-
|
|
67
|
-
/** 从起始下标处截出一段完整字面量文本,跳过字符串与注释。 */
|
|
68
|
-
function sliceLiteral(text, from) {
|
|
69
|
-
const start = text.indexOf('{', from);
|
|
70
|
-
if (start < 0) throw new Error('export const scene 之后找不到字面量起始 {');
|
|
71
|
-
let depth = 0;
|
|
72
|
-
for (let i = start; i < text.length; i += 1) {
|
|
73
|
-
const char = text[i];
|
|
74
|
-
const next = text[i + 1];
|
|
75
|
-
if (char === '/' && next === '/') { i = text.indexOf('\n', i); if (i < 0) break; continue; }
|
|
76
|
-
if (char === '/' && next === '*') { i = text.indexOf('*/', i + 2) + 1; if (i < 1) break; continue; }
|
|
77
|
-
if (char === "'" || char === '"' || char === '`') {
|
|
78
|
-
for (i += 1; i < text.length; i += 1) {
|
|
79
|
-
if (text[i] === '\\') { i += 1; continue; }
|
|
80
|
-
if (text[i] === char) break;
|
|
81
|
-
}
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
if (char === '{' || char === '[' || char === '(') depth += 1;
|
|
85
|
-
else if (char === '}' || char === ']' || char === ')') {
|
|
86
|
-
depth -= 1;
|
|
87
|
-
if (depth === 0) return { literal: text.slice(start, i + 1), start, end: i + 1 };
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
throw new Error('字面量括号不配对,无法截取(scene.ts 只允许纯字面量)');
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export function parseSceneSource(text) {
|
|
94
|
-
const matches = [...text.matchAll(EXPORT_RE)];
|
|
95
|
-
if (matches.length !== 1) {
|
|
96
|
-
throw new Error(`scene.ts 必须恰好有一条 export const scene: SceneData =(当前 ${matches.length} 条)`);
|
|
97
|
-
}
|
|
98
|
-
const match = matches[0];
|
|
99
|
-
const { literal, start, end } = sliceLiteral(text, match.index + match[0].length);
|
|
100
|
-
let data;
|
|
101
|
-
try { data = new Function(`return (${literal});`)(); }
|
|
102
|
-
catch (error) { throw new Error(`字面量求值失败(仅允许纯字面量,不得写表达式或变量引用): ${error.message}`); }
|
|
103
|
-
return { data, literal, start, end };
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/* ------------------------------------------------------------------ *
|
|
107
|
-
* SceneData 契约校验
|
|
108
|
-
* ------------------------------------------------------------------ */
|
|
109
|
-
|
|
110
|
-
const isPlainObject = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
111
|
-
const isText = (value) => typeof value === 'string' && value.length > 0;
|
|
112
|
-
const isFiniteNumber = (value) => typeof value === 'number' && Number.isFinite(value);
|
|
113
|
-
|
|
114
|
-
function checkNumbers(value, label, length, report) {
|
|
115
|
-
if (!Array.isArray(value) || value.length !== length || !value.every(isFiniteNumber)) {
|
|
116
|
-
report(`${label} 必须是 ${length} 个有限数字组成的数组`);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function checkTriple(value, label, report) { checkNumbers(value, label, 3, report); }
|
|
121
|
-
|
|
122
|
-
function checkLight(light, index, report) {
|
|
123
|
-
const label = `env.lights[${index}]`;
|
|
124
|
-
if (!isPlainObject(light)) return report(`${label} 必须是对象`);
|
|
125
|
-
if (!isText(light.name)) report(`${label}.name 缺失`);
|
|
126
|
-
if (!isFiniteNumber(light.intensity)) report(`${label}.intensity 必须是数字`);
|
|
127
|
-
if (light.kind === 'directional') {
|
|
128
|
-
if (!isText(light.color)) report(`${label}.color 缺失`);
|
|
129
|
-
checkTriple(light.pos, `${label}.pos`, report);
|
|
130
|
-
if (light.target !== undefined) checkTriple(light.target, `${label}.target`, report);
|
|
131
|
-
if (light.castShadow !== undefined && typeof light.castShadow !== 'boolean') report(`${label}.castShadow 必须是布尔值`);
|
|
132
|
-
} else if (light.kind === 'hemisphere') {
|
|
133
|
-
if (!isText(light.skyColor)) report(`${label}.skyColor 缺失`);
|
|
134
|
-
if (!isText(light.groundColor)) report(`${label}.groundColor 缺失`);
|
|
135
|
-
} else if (light.kind === 'point') {
|
|
136
|
-
if (!isText(light.color)) report(`${label}.color 缺失`);
|
|
137
|
-
checkTriple(light.pos, `${label}.pos`, report);
|
|
138
|
-
if (light.distance !== undefined && !isFiniteNumber(light.distance)) report(`${label}.distance 必须是数字`);
|
|
139
|
-
} else {
|
|
140
|
-
report(`${label}.kind 只能是 directional / hemisphere / point`);
|
|
141
|
-
}
|
|
142
|
-
const allowed = {
|
|
143
|
-
directional: ['kind', 'name', 'color', 'intensity', 'pos', 'target', 'castShadow'],
|
|
144
|
-
hemisphere: ['kind', 'name', 'skyColor', 'groundColor', 'intensity'],
|
|
145
|
-
point: ['kind', 'name', 'color', 'intensity', 'pos', 'distance'],
|
|
146
|
-
}[light.kind] ?? [];
|
|
147
|
-
for (const key of Object.keys(light)) {
|
|
148
|
-
if (!allowed.includes(key)) report(`${label}.${key} 不在 SceneLight 字段集内(字段集封闭)`);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
function checkEnv(env, report, warn) {
|
|
153
|
-
if (!isPlainObject(env)) return report('env 必须是对象(SceneData.env 是环境唯一事实源,不得缺省)');
|
|
154
|
-
if (!isText(env.background)) report('env.background 缺失(解析不到也要如实标注,不得伪造)');
|
|
155
|
-
if (env.fog !== null && env.fog !== undefined) {
|
|
156
|
-
if (!isPlainObject(env.fog)) report('env.fog 只能是 null 或 { color, near, far }');
|
|
157
|
-
else {
|
|
158
|
-
if (!isText(env.fog.color)) report('env.fog.color 缺失');
|
|
159
|
-
if (!isFiniteNumber(env.fog.near) || !isFiniteNumber(env.fog.far)) report('env.fog.near / far 必须是数字');
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
if (!isPlainObject(env.sky)) report('env.sky 缺失');
|
|
163
|
-
else if (env.sky.kind === 'gradient') {
|
|
164
|
-
if (Array.isArray(env.sky.stops)) {
|
|
165
|
-
const stops = env.sky.stops;
|
|
166
|
-
if (stops.length < 2) report('env.sky.stops 至少 2 项');
|
|
167
|
-
let previous = -Infinity;
|
|
168
|
-
stops.forEach((stop, index) => {
|
|
169
|
-
if (!isPlainObject(stop) || !isFiniteNumber(stop.at) || !isText(stop.color)) {
|
|
170
|
-
report(`env.sky.stops[${index}] 必须是 { at, color }`);
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
if (stop.at < 0 || stop.at > 1) report(`env.sky.stops[${index}].at 必须位于 [0, 1]`);
|
|
174
|
-
if (stop.at <= previous) report('env.sky.stops 的 at 必须严格递增');
|
|
175
|
-
previous = stop.at;
|
|
176
|
-
});
|
|
177
|
-
if (stops[0]?.at !== 0 || stops[stops.length - 1]?.at !== 1) report('env.sky.stops 首尾必须为 0 与 1');
|
|
178
|
-
} else if (isText(env.sky.top) && isText(env.sky.middle) && isText(env.sky.bottom)) {
|
|
179
|
-
warn('env.sky 仍是旧三段 top/middle/bottom 格式:编辑器可兼容读取,但新转换一律写 stops,建议按 at = 0 / 0.5 / 1 无损迁移');
|
|
180
|
-
} else {
|
|
181
|
-
report('env.sky.kind = gradient 时必须提供 stops');
|
|
182
|
-
}
|
|
183
|
-
} else if (env.sky.kind !== 'flat') {
|
|
184
|
-
report('env.sky.kind 只能是 flat 或 gradient');
|
|
185
|
-
}
|
|
186
|
-
if (!Array.isArray(env.lights)) report('env.lights 必须是数组');
|
|
187
|
-
else env.lights.forEach((light, index) => checkLight(light, index, report));
|
|
188
|
-
if (env.exposure !== undefined && !isFiniteNumber(env.exposure)) report('env.exposure 必须是数字');
|
|
189
|
-
if (env.runtimeControlled !== undefined && typeof env.runtimeControlled !== 'boolean') report('env.runtimeControlled 必须是布尔值');
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
function checkItem(item, index, report, seen) {
|
|
193
|
-
const label = `items[${index}]`;
|
|
194
|
-
if (!isPlainObject(item)) return report(`${label} 必须是对象`);
|
|
195
|
-
if (!isText(item.id)) report(`${label}.id 缺失`);
|
|
196
|
-
else if (seen.has(item.id)) report(`${label}.id 重复: ${item.id}`);
|
|
197
|
-
else seen.add(item.id);
|
|
198
|
-
if (!isPlainObject(item.source)) report(`${label}.source 缺失`);
|
|
199
|
-
else if (item.source.kind === 'slot') {
|
|
200
|
-
if (!isText(item.source.slot)) report(`${label}.source.slot 缺失`);
|
|
201
|
-
} else if (item.source.kind === 'glb') {
|
|
202
|
-
if (!isText(item.source.url)) report(`${label}.source.url 缺失`);
|
|
203
|
-
else if (!item.source.url.startsWith('/')) report(`${label}.source.url 应为 /Game/... 形式的虚拟路径`);
|
|
204
|
-
if (item.source.lod !== undefined && item.source.lod !== 0 && item.source.lod !== 1 && item.source.lod !== 2) {
|
|
205
|
-
report(`${label}.source.lod 只能是 0、1 或 2`);
|
|
206
|
-
}
|
|
207
|
-
if (item.source.lod === 0) report(`${label}.source.lod 显式写了 0,按序列化约定缺省值应省略`);
|
|
208
|
-
} else {
|
|
209
|
-
report(`${label}.source.kind 只能是 slot 或 glb`);
|
|
210
|
-
}
|
|
211
|
-
checkTriple(item.pos, `${label}.pos`, report);
|
|
212
|
-
checkTriple(item.rot, `${label}.rot`, report);
|
|
213
|
-
checkTriple(item.scale, `${label}.scale`, report);
|
|
214
|
-
if (item.label !== undefined && !isText(item.label)) report(`${label}.label 必须是非空字符串`);
|
|
215
|
-
if (item.tag !== undefined && !isText(item.tag)) report(`${label}.tag 必须是非空字符串`);
|
|
216
|
-
if (item.solid !== undefined && typeof item.solid !== 'boolean') report(`${label}.solid 必须是布尔值`);
|
|
217
|
-
if (item.solid === true) report(`${label}.solid 显式写了 true,按序列化约定缺省值应省略`);
|
|
218
|
-
if (item.params !== undefined) {
|
|
219
|
-
if (!isPlainObject(item.params)) report(`${label}.params 必须是对象`);
|
|
220
|
-
else {
|
|
221
|
-
for (const [key, value] of Object.entries(item.params)) {
|
|
222
|
-
if (!['number', 'string', 'boolean'].includes(typeof value) || (typeof value === 'number' && !Number.isFinite(value))) {
|
|
223
|
-
report(`${label}.params.${key} 只能是扁平 number|string|boolean`);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
if (Object.keys(item.params).length === 0) report(`${label}.params 为空对象,按序列化约定应省略`);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
const allowed = ['id', 'source', 'pos', 'rot', 'scale', 'label', 'params', 'tag', 'solid'];
|
|
230
|
-
for (const key of Object.keys(item)) {
|
|
231
|
-
if (!allowed.includes(key)) report(`${label}.${key} 不在 SceneItem 字段集内(字段集封闭)`);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
export function validateSceneData(data, warnings = []) {
|
|
236
|
-
const errors = [];
|
|
237
|
-
const report = (message) => errors.push(message);
|
|
238
|
-
const warn = (message) => warnings.push(message);
|
|
239
|
-
if (!isPlainObject(data)) { report('scene 字面量必须是对象'); return errors; }
|
|
240
|
-
if (data.version !== 1) report('version 必须是 1');
|
|
241
|
-
if (!isText(data.name)) report('name 缺失');
|
|
242
|
-
if (!isPlainObject(data.space)) report('space 缺失');
|
|
243
|
-
else {
|
|
244
|
-
checkNumbers(data.space.ground, 'space.ground', 2, report);
|
|
245
|
-
if (data.space.bounds !== undefined && !isFiniteNumber(data.space.bounds)) report('space.bounds 必须是数字');
|
|
246
|
-
}
|
|
247
|
-
checkEnv(data.env, report, warn);
|
|
248
|
-
if (!Array.isArray(data.items)) report('items 必须是数组');
|
|
249
|
-
else {
|
|
250
|
-
const seen = new Set();
|
|
251
|
-
data.items.forEach((item, index) => checkItem(item, index, report, seen));
|
|
252
|
-
}
|
|
253
|
-
return errors;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
/** 序列化格式约定自查(不阻断,只报告编辑器退出保存时会产生格式化 diff 的位置)。 */
|
|
257
|
-
function lintSerialization(text, literal) {
|
|
258
|
-
const warnings = [];
|
|
259
|
-
if (literal.includes('"')) warnings.push('字面量出现双引号,序列化约定为单引号');
|
|
260
|
-
const decimals = literal.match(/\d+\.\d{4,}/g);
|
|
261
|
-
if (decimals) warnings.push(`数字超过 3 位小数(如 ${decimals.slice(0, 3).join(', ')}),序列化约定为 3 位小数去尾零`);
|
|
262
|
-
const padded = literal.match(/\d+\.\d*0(?![.\d])/g);
|
|
263
|
-
if (padded) warnings.push(`数字带尾零(如 ${padded.slice(0, 3).join(', ')}),序列化约定去尾零`);
|
|
264
|
-
if (/\b-0(\.0+)?\b/.test(literal)) warnings.push('出现负零,序列化约定归一为 0');
|
|
265
|
-
if (text.includes('scene_config')) warnings.push('出现 scene_config:环境唯一事实源是 SceneData.env');
|
|
266
|
-
return warnings;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
/* ------------------------------------------------------------------ *
|
|
270
|
-
* 项目侧检查
|
|
271
|
-
* ------------------------------------------------------------------ */
|
|
272
|
-
|
|
273
|
-
async function listFiles(root, options = {}) {
|
|
274
|
-
const result = [];
|
|
275
|
-
if (!(await statOrNull(root))) return result;
|
|
276
|
-
const entries = await readdir(root, { withFileTypes: true });
|
|
277
|
-
for (const entry of entries) {
|
|
278
|
-
if (['node_modules', 'dist', '.git'].includes(entry.name)) continue;
|
|
279
|
-
const full = join(root, entry.name);
|
|
280
|
-
if (entry.isDirectory()) {
|
|
281
|
-
if (options.recursive) result.push(...await listFiles(full, options));
|
|
282
|
-
} else if (!options.ext || options.ext.some((ext) => entry.name.endsWith(ext))) {
|
|
283
|
-
result.push(full);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
return result;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* 定位 items 场景(支持多关卡):src/scenes 下每个 scene.ts 都是一关;
|
|
291
|
-
* projectDisplayInfo.scene 声明主关,未声明时主关取第一个(与编辑器自动探测一致)。
|
|
292
|
-
*/
|
|
293
|
-
async function findScenes(project) {
|
|
294
|
-
const displayPath = await projectFile(project, DISPLAY_FILE);
|
|
295
|
-
const warnings = [];
|
|
296
|
-
let display = null;
|
|
297
|
-
try { display = await readJsonFile(displayPath); }
|
|
298
|
-
catch (error) { if (error.code !== 'ENOENT') throw new Error(`projectDisplayInfo.json 无法解析: ${error.message}`); }
|
|
299
|
-
|
|
300
|
-
const scenesRoot = await projectFile(project, SCENES_DIR);
|
|
301
|
-
const candidates = (await listFiles(scenesRoot, { recursive: true, ext: ['scene.ts'] }))
|
|
302
|
-
.map((file) => toPosix(relative(resolve(project), file)))
|
|
303
|
-
.sort();
|
|
304
|
-
|
|
305
|
-
const scenes = [];
|
|
306
|
-
if (candidates.length === 0) {
|
|
307
|
-
// 兼容旧约定:单一场景可由 display.scene 指向 src/scenes 之外的文件
|
|
308
|
-
if (display && isText(display.scene)) {
|
|
309
|
-
const target = await projectFile(project, toPosix(display.scene));
|
|
310
|
-
if (!(await statOrNull(target))) throw new Error(`projectDisplayInfo.json 的 scene 指向不存在的文件: ${display.scene}`);
|
|
311
|
-
scenes.push({ path: target, rel: toPosix(display.scene) });
|
|
312
|
-
warnings.push(`场景位于 ${SCENES_DIR} 之外(${display.scene});多关卡约定要求各关放在 ${SCENES_DIR}/<关卡名>/scene.ts`);
|
|
313
|
-
} else {
|
|
314
|
-
throw new Error(`未发现 items 场景(${SCENES_DIR}/<关卡>/scene.ts);本项目尚未接入场景编辑器或场景路径不合约定`);
|
|
315
|
-
}
|
|
316
|
-
} else {
|
|
317
|
-
for (const rel of candidates) scenes.push({ path: await projectFile(project, rel), rel });
|
|
318
|
-
if (candidates.length === 1 && !(display && isText(display.scene))) {
|
|
319
|
-
warnings.push(`projectDisplayInfo.json 未声明 scene 字段,按唯一场景 ${candidates[0]} 检查(编辑器端会退回自动探测,建议显式声明)`);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
let primaryRel = scenes[0]?.rel ?? null;
|
|
324
|
-
if (display && isText(display.scene)) {
|
|
325
|
-
const declared = toPosix(display.scene);
|
|
326
|
-
if (!scenes.some((scene) => scene.rel === declared)) {
|
|
327
|
-
throw new Error(`projectDisplayInfo.json 的 scene 指向 ${declared},但它不是 ${SCENES_DIR} 下的 scene.ts(发现的关卡:${scenes.map((scene) => scene.rel).join(', ') || '无'})`);
|
|
328
|
-
}
|
|
329
|
-
primaryRel = declared;
|
|
330
|
-
} else if (scenes.length > 1) {
|
|
331
|
-
warnings.push(`多关卡项目未声明 scene 字段,主关按第一个 items 场景 ${primaryRel}(建议在 ${DISPLAY_FILE} 显式声明)`);
|
|
332
|
-
}
|
|
333
|
-
return { display, scenes, primaryRel, warnings };
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* 取出 `export const <name> = { ... }` 的对象字面量体(括号配平)。
|
|
338
|
-
* 槽位模块里常把「公共槽位 + 各关专有槽位」并列放同一个文件,
|
|
339
|
-
* 只有按对象名切片才能区分本关实际展开的是哪几个。
|
|
340
|
-
*/
|
|
341
|
-
function sliceExportObject(source, name) {
|
|
342
|
-
const head = new RegExp(`export\\s+const\\s+${name}\\b[^=]*=\\s*\\{`).exec(source);
|
|
343
|
-
if (!head) return null;
|
|
344
|
-
let depth = 1;
|
|
345
|
-
let index = head.index + head[0].length;
|
|
346
|
-
const start = index;
|
|
347
|
-
for (; index < source.length && depth > 0; index++) {
|
|
348
|
-
const ch = source[index];
|
|
349
|
-
if (ch === '{') depth += 1;
|
|
350
|
-
else if (ch === '}') depth -= 1;
|
|
351
|
-
}
|
|
352
|
-
return depth === 0 ? source.slice(start, index - 1) : null;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
async function checkSlots(project, sceneRel, data, report, warnings) {
|
|
356
|
-
const sceneDir = dirname(sceneRel);
|
|
357
|
-
const slotsRel = toPosix(join(sceneDir, 'slots.ts'));
|
|
358
|
-
const slotsPath = await projectFile(project, slotsRel);
|
|
359
|
-
const source = await readFile(slotsPath, 'utf8').catch((error) => {
|
|
360
|
-
if (error.code === 'ENOENT') throw new Error(`缺少槽位注册表: ${slotsRel}`);
|
|
361
|
-
throw error;
|
|
362
|
-
});
|
|
363
|
-
if (!/export\s+const\s+slots\s*:/.test(source)) throw new Error(`${slotsRel} 缺少 export const slots: Record<string, SlotDef>`);
|
|
364
|
-
const keys = new Set();
|
|
365
|
-
const sharedKeys = new Set();
|
|
366
|
-
for (const line of source.split('\n')) {
|
|
367
|
-
const match = /^\s{1,6}['"]?([A-Za-z0-9_$@-]+)['"]?\s*:\s*\{/.exec(line);
|
|
368
|
-
if (match) keys.add(match[1]);
|
|
369
|
-
}
|
|
370
|
-
// 共享槽位(第 2 步公共槽位模块)从外部模块并入,本关 slots.ts 通常写成 `{ ...sharedSlots }`、
|
|
371
|
-
// 不重复列出键——把那些模块里**定义的键**收进 keys,并记进 sharedKeys 供跨关重名判据排除。
|
|
372
|
-
const imports = [...source.matchAll(/^import\s+\{([^}]+)\}\s+from\s+['"](\.[^'"]+)['"]/gm)];
|
|
373
|
-
const sharedModules = [];
|
|
374
|
-
for (const [, names, spec] of imports) {
|
|
375
|
-
// 只沿「被展开进 slots 的模块」找共享键:该模块的导出名要在本文件里出现过(`...sharedSlots` 等)。
|
|
376
|
-
const aliases = names.split(',').map((raw) => (raw.includes(' as ') ? raw.split(' as ').pop().trim() : raw.trim())).filter(Boolean);
|
|
377
|
-
const used = aliases.filter((name) => new RegExp(`\\.\\.\\.\\s*${name}\\b`).test(source));
|
|
378
|
-
if (used.length === 0) continue;
|
|
379
|
-
const base = toPosix(join(sceneDir, spec));
|
|
380
|
-
const file = /\.(m?ts|js)$/.test(base) ? base : `${base}.ts`;
|
|
381
|
-
const target = await projectFile(project, file);
|
|
382
|
-
const text = await readFile(target, 'utf8').catch(() => null);
|
|
383
|
-
if (!text) { warnings.push(`${slotsRel} 引入的共享槽位模块 ${file} 读取不到,跳过其键的纳入`); continue; }
|
|
384
|
-
sharedModules.push(toPosix(relative(resolve(project), target)));
|
|
385
|
-
// 只收「确实被展开进本关 slots 的那个导出对象」的键。共享模块里通常并列放着公共槽位与
|
|
386
|
-
// 各关专有槽位(sharedSlots / desertSlots / oasisSlots / forestSlots 常在同一个文件),
|
|
387
|
-
// 整文件收集会把别的关的键也算进本关,后果是三连环:
|
|
388
|
-
// ①「scene.ts 引用了 slots.ts 中不存在的槽位」永不触发;
|
|
389
|
-
// ② localKeys 被清空(本关所有键都算共享键)→「跨关重名」判据永不触发;
|
|
390
|
-
// ③ 装配侧的槽位错配(用 A 关注册表装 B 关数据)被掩盖(见 checkLevelSlotCoverage)。
|
|
391
|
-
for (const name of used) {
|
|
392
|
-
const block = sliceExportObject(text, name);
|
|
393
|
-
if (block === null) {
|
|
394
|
-
warnings.push(`${file} 未找到 ${name} 的对象字面量,跳过该模块键的纳入`);
|
|
395
|
-
continue;
|
|
396
|
-
}
|
|
397
|
-
for (const line of block.split('\n')) {
|
|
398
|
-
const match = /^\s{0,6}['"]?([A-Za-z0-9_$@-]+)['"]?\s*:\s*\{/.exec(line);
|
|
399
|
-
if (match) { keys.add(match[1]); sharedKeys.add(match[1]); }
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
// 本关 slots.ts 自己写出的键(= 未标记为共享的),跨关重名只判这一部分:共享键由公共模块定义一次。
|
|
404
|
-
const localKeys = new Set([...keys].filter((key) => !sharedKeys.has(key)));
|
|
405
|
-
// 本关只做展开、没有自建键时,localKeys 为空是共享模块的正常形态;只有连共享键都没收到才算解析失败。
|
|
406
|
-
if (keys.size === 0) {
|
|
407
|
-
warnings.push(`${slotsRel} 未解析出槽位键,跳过槽位覆盖比对`);
|
|
408
|
-
}
|
|
409
|
-
const used = new Set(data.items.filter((item) => item.source?.kind === 'slot').map((item) => item.source.slot));
|
|
410
|
-
for (const slot of used) {
|
|
411
|
-
if (!keys.has(slot)) report(`scene.ts 引用了 slots.ts 中不存在的槽位: ${slot}(装配侧会跳过该物件)`);
|
|
412
|
-
}
|
|
413
|
-
for (const key of keys) {
|
|
414
|
-
if (!used.has(key)) warnings.push(`槽位 ${key} 未被任何 item 使用(可能残留或留给编辑器放置)`);
|
|
415
|
-
}
|
|
416
|
-
return { slotsRel, slotsPath, keys, localKeys, sharedModules, used };
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
async function checkBundle(project, sceneDataList, slotKeys, report, warnings) {
|
|
420
|
-
const bundlePath = await projectFile(project, BUNDLE_FILE);
|
|
421
|
-
const bundleStat = await statOrNull(bundlePath);
|
|
422
|
-
const slotItems = sceneDataList.flatMap((data) =>
|
|
423
|
-
(Array.isArray(data.items) ? data.items : []).filter((item) => item.source?.kind === 'slot'),
|
|
424
|
-
);
|
|
425
|
-
if (!bundleStat) {
|
|
426
|
-
if (slotItems.length > 0) report(`缺少 ${BUNDLE_FILE}:编辑器无法执行项目造型代码,对应槽位只显示占位盒(必须随项目文件交付)`);
|
|
427
|
-
return null;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
let THREE = null;
|
|
431
|
-
try {
|
|
432
|
-
const requireFromProject = createRequire(join(resolve(project), 'package.json'));
|
|
433
|
-
THREE = requireFromProject('three');
|
|
434
|
-
} catch {
|
|
435
|
-
warnings.push(`未能从项目依赖解析 three,跳过 ${BUNDLE_FILE} 的执行三查(仅核对文件存在)`);
|
|
436
|
-
return null;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
const source = await readFile(bundlePath, 'utf8');
|
|
440
|
-
const registry = {};
|
|
441
|
-
const shim = (name) => {
|
|
442
|
-
if (name === 'three') return THREE;
|
|
443
|
-
throw new Error(`bundle 依赖了编辑器无法提供的模块: ${name}`);
|
|
444
|
-
};
|
|
445
|
-
try {
|
|
446
|
-
const fn = new Function('require', 'module', 'exports', 'registerSlotBuilders', source);
|
|
447
|
-
fn(shim, { exports: {} }, {}, (defs) => Object.assign(registry, defs ?? {}));
|
|
448
|
-
} catch (error) {
|
|
449
|
-
report(`${BUNDLE_FILE} 执行失败(与编辑器 loadSource 同构执行): ${error.message}`);
|
|
450
|
-
return null;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
const registered = Object.keys(registry);
|
|
454
|
-
if (registered.length === 0) report(`${BUNDLE_FILE} 未调用 registerSlotBuilders,编辑器拿不到任何槽位`);
|
|
455
|
-
for (const key of registered) if (!slotKeys.has(key)) report(`${BUNDLE_FILE} 注册了 slots.ts 中不存在的槽位: ${key}`);
|
|
456
|
-
for (const key of slotKeys) if (!registry[key]) report(`${BUNDLE_FILE} 缺少槽位: ${key}`);
|
|
457
|
-
|
|
458
|
-
const meshesOf = (object) => {
|
|
459
|
-
let meshes = 0;
|
|
460
|
-
object?.traverse?.((node) => { if (node.isMesh) meshes += 1; });
|
|
461
|
-
return meshes;
|
|
462
|
-
};
|
|
463
|
-
// 造型根节点自带的 transform 会被游戏侧直挂装配覆盖(见 checkAssemblyParity),逐个记录命中的分量。
|
|
464
|
-
// 分量要分开报:rotation 被清零是姿态丢失(躺平的地面竖起),position 被清零是下沉,两者修法不同。
|
|
465
|
-
// 这里跑的是 bundle 里的真代码,比正则猜函数体准。
|
|
466
|
-
const rootOffsetOf = (object) => {
|
|
467
|
-
const parts = [];
|
|
468
|
-
const { x: px, y: py, z: pz } = object.position;
|
|
469
|
-
if (Math.abs(px) + Math.abs(py) + Math.abs(pz) > 1e-6) parts.push('position');
|
|
470
|
-
const { x: rx, y: ry, z: rz } = object.rotation;
|
|
471
|
-
if (Math.abs(rx) + Math.abs(ry) + Math.abs(rz) > 1e-6) parts.push('rotation');
|
|
472
|
-
const { x: sx, y: sy, z: sz } = object.scale;
|
|
473
|
-
if (Math.abs(sx - 1) + Math.abs(sy - 1) + Math.abs(sz - 1) > 1e-6) parts.push('scale');
|
|
474
|
-
return parts;
|
|
475
|
-
};
|
|
476
|
-
const files = [];
|
|
477
|
-
const rootOffsets = [];
|
|
478
|
-
for (const [slot, def] of Object.entries(registry)) {
|
|
479
|
-
try {
|
|
480
|
-
const object = def.build();
|
|
481
|
-
if (!object || typeof object.traverse !== 'function') report(`槽位 ${slot} 的 build() 未返回 Object3D`);
|
|
482
|
-
else {
|
|
483
|
-
files.push({ slot, meshes: meshesOf(object) });
|
|
484
|
-
const parts = rootOffsetOf(object);
|
|
485
|
-
if (parts.length > 0) rootOffsets.push({ slot, parts });
|
|
486
|
-
}
|
|
487
|
-
} catch (error) {
|
|
488
|
-
report(`槽位 ${slot} 的 build() 抛错: ${error.message}`);
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
const paramsItems = slotItems.filter((item) => item.params && Object.keys(item.params).length > 0);
|
|
493
|
-
for (const item of paramsItems) {
|
|
494
|
-
const def = registry[item.source.slot];
|
|
495
|
-
if (!def) continue;
|
|
496
|
-
const perturbed = { ...item.params };
|
|
497
|
-
let changed = false;
|
|
498
|
-
for (const [key, value] of Object.entries(perturbed)) {
|
|
499
|
-
if (typeof value === 'number') { perturbed[key] = value === 0 ? 1 : value * 1.5; changed = true; }
|
|
500
|
-
else if (typeof value === 'boolean') { perturbed[key] = !value; changed = true; }
|
|
501
|
-
}
|
|
502
|
-
if (!changed) continue;
|
|
503
|
-
try {
|
|
504
|
-
const sizeOf = (params) => {
|
|
505
|
-
const box = new THREE.Box3().setFromObject(registry[item.source.slot].build(params));
|
|
506
|
-
const size = new THREE.Vector3();
|
|
507
|
-
box.getSize(size);
|
|
508
|
-
return size;
|
|
509
|
-
};
|
|
510
|
-
const a = sizeOf(item.params);
|
|
511
|
-
const b = sizeOf(perturbed);
|
|
512
|
-
if (Math.abs(a.x - b.x) + Math.abs(a.y - b.y) + Math.abs(a.z - b.z) < 1e-4) {
|
|
513
|
-
warnings.push(`item ${item.id}(槽位 ${item.source.slot})换参数后包围盒不变,未能证明 params 直通(参数可能只影响材质,需人工确认)`);
|
|
514
|
-
}
|
|
515
|
-
} catch (error) {
|
|
516
|
-
report(`item ${item.id} 带 params 构建失败: ${error.message}`);
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
return { files, registered, rootOffsets };
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
/**
|
|
524
|
-
* 跨端装配同构判定。
|
|
525
|
-
*
|
|
526
|
-
* 编辑器装配是「container 承载 item 的 pos/rot/scale,build 结果作为它的子节点」
|
|
527
|
-
* (`SceneLoader._buildItem`:`container.position.set(item.pos…)` 后 `container.add(builder.build(…))`),
|
|
528
|
-
* 所以造型根节点自带的 transform 在编辑器里被完整保留。游戏侧若把 build 结果直接当根、把 item.pos
|
|
529
|
-
* 写到它身上,造型自带的那份就被覆盖——两端相差该偏移量。
|
|
530
|
-
*
|
|
531
|
-
* 实测形态(两类,根因同一个):
|
|
532
|
-
* - position:`crate.position.y = size / 2`(接地偏移写在根节点),编辑器里箱子底面贴屋面,
|
|
533
|
-
* 游戏里下沉 size/2 后整段埋进檐口装饰层,只剩半截露出。
|
|
534
|
-
* - rotation:`mesh.rotation.x = -Math.PI / 2`(躺平姿态写在根节点),编辑器里地面水平,
|
|
535
|
-
* 游戏里姿态被清零 → PlaneGeometry 保持默认竖直姿态,地面立起 90°。
|
|
536
|
-
* 同项目的 `building` 返回 `new THREE.Group()`、偏移放子节点,因此不受影响。
|
|
537
|
-
*
|
|
538
|
-
* 两端对齐有两条路,任一成立即可:
|
|
539
|
-
* ① 装配侧包载体(同构):新建 Group 承载 item 变换,再 add(build 结果)
|
|
540
|
-
* ② 造型根节点恒等:build 返回对象自身 position/rotation 为零、scale 为一
|
|
541
|
-
*/
|
|
542
|
-
function checkAssemblyParity(mountSources, rootOffsets, report) {
|
|
543
|
-
if (rootOffsets.length === 0) return;
|
|
544
|
-
// 载体必须真的当摆位宿主用过:同一个标识符创建出来后要 add() 造型结果。
|
|
545
|
-
// 只认「new Group() 出现过」不够——装配文件里任何一处无关的 Group 都会把这条判据静默压住(已实测)。
|
|
546
|
-
const wrapped = mountSources.some((source) => CARRIER_MOUNT.test(source));
|
|
547
|
-
if (wrapped) return;
|
|
548
|
-
const named = rootOffsets.map((entry) => `${entry.slot}(${entry.parts.join('+')})`);
|
|
549
|
-
const slots = named.slice(0, 3).join(', ');
|
|
550
|
-
report(
|
|
551
|
-
`${rootOffsets.length} 个槽位的 build 返回对象自带非恒等 transform(${slots}`
|
|
552
|
-
+ `${named.length > 3 ? ' …' : ''}):编辑器在造型外套一层 container,这份 transform 被保留;`
|
|
553
|
-
+ '游戏侧直挂 build 结果时会覆盖它,两端因此不一致——rotation 被清零时姿态丢失'
|
|
554
|
-
+ '(躺平的地面竖起 90°、朝上的锥体翻倒),position 被清零时整件下沉,scale 被清零时整件缩回默认大小。'
|
|
555
|
-
+ '两个做法任选——装配侧新建 Group 承载 item 的 pos/rot/scale 后再 add(build 结果),'
|
|
556
|
-
+ '或让根节点保持恒等、把变换做进子节点或几何体本身(geometry.translate / geometry.rotateX,见第 7 步装配同构)',
|
|
557
|
-
);
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
/** 收集某一关的装配源码:认真的定义了 mountScene 的文件,并**跟一跳相对引用**。
|
|
561
|
-
* 仅提到 mountScene 的调用方(如 world.ts)不参与判据,否则调用方的字面量会污染检查
|
|
562
|
-
* (scene.ts 自身也含 'glb',同样必须排除)。
|
|
563
|
-
*
|
|
564
|
-
* 返回两份,用途严格分开:
|
|
565
|
-
* - `own`:本关装配文件自身。跨端装配同构(checkAssemblyParity)与预载回补只看这一份——
|
|
566
|
-
* 跟了引用的版本会把造型文件(slots.ts)一并并入,而造型内部的 `const g = new THREE.Group();
|
|
567
|
-
* g.add(mesh)` 会被 CARRIER_MOUNT 误认成「装配侧包了载体」,静默压掉根节点偏移的报错(实测回归)。
|
|
568
|
-
* - `withDeps`:再并入一跳相对引用的模块。只喂 glb 分支判据:多关卡工程常把关内 mount.ts
|
|
569
|
-
* 写成薄壳、装配主体(含 glb 分支)抽到 src/scenes/shared/ 里,不看这一层就会把
|
|
570
|
-
* 「模块里有分支」误判成「装配侧无分支」,报错文案把 agent 引到错误文件上
|
|
571
|
-
* (往 mount.ts 里加重复分支,而不是去修入口接线)。 */
|
|
572
|
-
async function collectMountSource(project, sceneRel) {
|
|
573
|
-
const sceneDirAbs = dirname(await projectFile(project, sceneRel));
|
|
574
|
-
const sources = await listFiles(sceneDirAbs, { ext: ['.ts'] });
|
|
575
|
-
const defining = [];
|
|
576
|
-
for (const file of sources) {
|
|
577
|
-
const text = await readFile(file, 'utf8');
|
|
578
|
-
if (/\b(?:export\s+)?(?:async\s+)?function\s+mountScene\b/.test(text)
|
|
579
|
-
|| /\bmountScene\s*[:=]\s*(?:async\s*)?\(?/.test(text)) {
|
|
580
|
-
defining.push({ file, text });
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
if (defining.length === 0) return null;
|
|
584
|
-
const own = defining.map((entry) => entry.text).join('\n');
|
|
585
|
-
let withDeps = own;
|
|
586
|
-
const seen = new Set(defining.map((entry) => entry.file));
|
|
587
|
-
for (const { file, text } of defining) {
|
|
588
|
-
for (const match of text.matchAll(/from\s+['"](\.[^'"]+)['"]/g)) {
|
|
589
|
-
const base = resolve(dirname(file), match[1]);
|
|
590
|
-
let dep = null;
|
|
591
|
-
for (const candidate of [base, `${base}.ts`, join(base, 'index.ts')]) {
|
|
592
|
-
if (await statOrNull(candidate)) { dep = candidate; break; }
|
|
593
|
-
}
|
|
594
|
-
if (!dep || seen.has(dep)) continue;
|
|
595
|
-
seen.add(dep);
|
|
596
|
-
withDeps += `\n${await readFile(dep, 'utf8')}`;
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
return { own, withDeps, files: defining.map((entry) => entry.file) };
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
/**
|
|
603
|
-
* 入口里 `mountScene` 的别名(`import { mountScene as mountDesert }`)。
|
|
604
|
-
*
|
|
605
|
-
* 多关卡工程的正解就是按关卡分发到各关装配函数,写法必然是别名导入——只认字面量
|
|
606
|
-
* `mountScene(` 会把这种**已经接线**的形态误判成「没接线」,正好和判据想抓的问题反了。
|
|
607
|
-
*/
|
|
608
|
-
function mountAliasesOf(text) {
|
|
609
|
-
const aliases = new Set();
|
|
610
|
-
for (const match of text.matchAll(/import\s*\{([^}]+)\}\s*from\s*['"][^'"]*mount[^'"]*['"]/g)) {
|
|
611
|
-
for (const raw of match[1].split(',')) {
|
|
612
|
-
const part = raw.trim();
|
|
613
|
-
if (!part || !/\bmountScene\b/.test(part)) continue;
|
|
614
|
-
const alias = part.includes(' as ') ? part.split(' as ').pop().trim() : 'mountScene';
|
|
615
|
-
if (alias !== 'mountScene') aliases.add(alias);
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
return [...aliases];
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
/** 入口对 `mountScene`(含别名)的接线次数,扣掉函数定义本身那一处。
|
|
622
|
-
*
|
|
623
|
-
* 别名的判定不看 `alias(` 调用形式:多关卡按关卡分发最常见的写法是把各关装配函数放进数组或映射
|
|
624
|
-
* 再按下标取用(`const MOUNTERS = [mountDesert, mountOasis, mountForest]`),
|
|
625
|
-
* 这种形态下没有任何 `alias(...)` 字面量调用。所以数的是「别名在 import 之外出现过」,
|
|
626
|
-
* 只有「import 了却从未使用」才继续怀疑。 */
|
|
627
|
-
function mountCallCount(text) {
|
|
628
|
-
const defined = (text.match(/(?:export\s+)?(?:async\s+)?function\s+mountScene\b/g) || []).length;
|
|
629
|
-
let called = (text.match(/(?<![A-Za-z_.$])mountScene\s*\(/g) || []).length - defined;
|
|
630
|
-
const body = text.replace(/import\s*\{[^}]*\}\s*from\s*['"][^'"]+['"];?/g, '');
|
|
631
|
-
for (const alias of mountAliasesOf(text)) {
|
|
632
|
-
called += (body.match(new RegExp(`(?<![A-Za-z_.$])${alias}\\b`, 'g')) || []).length;
|
|
633
|
-
}
|
|
634
|
-
return called;
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
/**
|
|
638
|
-
* 多关卡装配覆盖:入口容易只接一关的装配函数。
|
|
639
|
-
*
|
|
640
|
-
* 各关 `mount.ts` 是「把本关 slots 注册表绑进共享装配」的包装(`mountShared(target, data, slots)`),
|
|
641
|
-
* 天然与关卡数据一一对应。入口若只从某一关导入 `mountScene` 去装配**全部**关卡,
|
|
642
|
-
* 其余关卡 `scene.ts` 里的专有槽位键就落进那一关的注册表 → 装配侧按「未知槽位,跳过」处理(仅 warn)
|
|
643
|
-
* → 物件静默消失,而 scene.ts 契约、slots.ts、bundle 三查全绿。
|
|
644
|
-
*
|
|
645
|
-
* `checkSlots` 看不见这个错配:它是「本关 scene.ts vs 本关 slots.ts」的自洽性检查,
|
|
646
|
-
* 而错配发生在**装配时**——用 A 关的注册表装 B 关的数据,两个文件各自都是对的。
|
|
647
|
-
*
|
|
648
|
-
* 实测形态:三关项目入口写 `import { mountScene } from '../scenes/desert/mount'`,
|
|
649
|
-
* 绿洲的 palm/reed、森林的 tree/vine/mushroom/log 全部丢失。视觉复验当时只验了主关,
|
|
650
|
-
* 所以现场没发现(非主关的画面丢失最容易漏)。
|
|
651
|
-
*/
|
|
652
|
-
async function checkLevelSlotCoverage(project, levels, report, warnings) {
|
|
653
|
-
if (levels.length < 2) return;
|
|
654
|
-
const withMount = levels.filter((level) => level.mountAbs);
|
|
655
|
-
if (withMount.length < 2) return; // 各关共用一份装配时没有错配空间
|
|
656
|
-
|
|
657
|
-
const root = resolve(project);
|
|
658
|
-
const srcDir = await projectFile(root, 'src');
|
|
659
|
-
const files = await listFiles(srcDir, { ext: ['.ts', '.tsx', '.js', '.mjs'], recursive: true });
|
|
660
|
-
const wired = new Set();
|
|
661
|
-
for (const file of files) {
|
|
662
|
-
const text = await readFile(file, 'utf8');
|
|
663
|
-
if (mountCallCount(text) <= 0) continue;
|
|
664
|
-
for (const match of text.matchAll(/from\s+['"](\.[^'"]+)['"]/g)) {
|
|
665
|
-
const base = resolve(dirname(file), match[1]);
|
|
666
|
-
for (const candidate of [base, `${base}.ts`, join(base, 'index.ts')]) {
|
|
667
|
-
const hit = withMount.find((level) => toPosix(candidate) === toPosix(level.mountAbs));
|
|
668
|
-
if (hit) { wired.add(hit.rel); break; }
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
if (wired.size === 0) {
|
|
673
|
-
warnings.push('未识别出装配入口 import 的关卡装配模块,跳过多关卡槽位覆盖比对');
|
|
674
|
-
return;
|
|
675
|
-
}
|
|
676
|
-
if (wired.size >= withMount.length) return;
|
|
677
|
-
|
|
678
|
-
// 未接线关卡的 scene.ts 用到的槽位键,在**已接线关卡**的注册表里是否都存在
|
|
679
|
-
const provided = new Set();
|
|
680
|
-
for (const level of withMount) {
|
|
681
|
-
if (!wired.has(level.rel)) continue;
|
|
682
|
-
for (const key of level.providedKeys) provided.add(key);
|
|
683
|
-
}
|
|
684
|
-
const missingLevels = withMount.filter((level) => !wired.has(level.rel));
|
|
685
|
-
const problems = [];
|
|
686
|
-
for (const level of missingLevels) {
|
|
687
|
-
const missing = [...level.usedSlots].filter((key) => !provided.has(key));
|
|
688
|
-
if (missing.length > 0) problems.push(`${level.rel} 缺 ${missing.join('/')}`);
|
|
689
|
-
}
|
|
690
|
-
if (problems.length === 0) return;
|
|
691
|
-
report(
|
|
692
|
-
`多关卡装配只接了部分关卡(已接: ${[...wired].join(', ')};未接: ${missingLevels.map((l) => l.rel).join(', ')}):`
|
|
693
|
-
+ `未接关卡的 scene.ts 会被已接关卡的槽位注册表装配,其专有槽位在运行时按「未知槽位,跳过」静默丢失`
|
|
694
|
-
+ `(${problems.join(';')})。两边的 scene.ts 与 slots.ts 各自都自洽,所以按关跑的槽位判据发现不了。`
|
|
695
|
-
+ '修法是让入口按关卡分发到各自的 mount.ts,而不是从某一关导入一个装配函数装全部(见第 8 步多关卡装配)',
|
|
696
|
-
);
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
/**
|
|
700
|
-
* 装配侧判据(项目级跑一次):glb 装配环 + 通用碰撞桥消费。
|
|
701
|
-
*
|
|
702
|
-
* 装配能力是项目级属性——main.ts 一份、装配写法全项目一致,所以全部关的装配源码合并后统一判。
|
|
703
|
-
* 按关卡各判一次会让同一条问题重复 N 遍(实测多关卡项目里同一份 main.ts 被报 9 次),淹没真正要看的信息。
|
|
704
|
-
*/
|
|
705
|
-
function checkAssemblyHints(mountSources, glbSources, needsBridge, report, warnings) {
|
|
706
|
-
if (mountSources.length === 0) {
|
|
707
|
-
warnings.push('未在场景目录找到 mountScene 装配代码,glb 分支、跨端装配同构与通用碰撞桥需人工确认');
|
|
708
|
-
return;
|
|
709
|
-
}
|
|
710
|
-
const source = mountSources.join('\n');
|
|
711
|
-
// glb 分支判据用并了一跳引用的版本(装配主体可能被抽到 shared/),其余判据只看装配文件自身。
|
|
712
|
-
checkGlbBranch(glbSources.join('\n'), report, warnings);
|
|
713
|
-
if (needsBridge && !/\bsolid\b/.test(source)) {
|
|
714
|
-
warnings.push('装配侧未出现 solid 字段消费:编辑器碰撞开关可能静默无效(见第 7 步通用碰撞桥)');
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
/**
|
|
719
|
-
* 装配接线:各关的 mountScene 是装配的唯一入口——游戏侧要调用它,不能自己再写一遍 items 遍历。
|
|
720
|
-
*
|
|
721
|
-
* 前面几条判据只看「装配函数内部有没有 glb 分支」,看不见「入口压根没调这个函数」。
|
|
722
|
-
* 实测形态:多关卡工程里各关 mount.ts 与共享 mountCore.ts 都写得完整(glb 分支、碰撞桥齐全),
|
|
723
|
-
* 但游戏入口 game.ts 自己写了个 `for (const item of data.items)` 循环、第一行就把
|
|
724
|
-
* `item.source.kind !== 'slot'` 的项 continue 掉——装配函数整套是死代码,云资产永远缺席,
|
|
725
|
-
* 而 build / typecheck / 前面几条判据全绿(场景照常渲染,只少了云资产,视觉上不显眼)。
|
|
726
|
-
*
|
|
727
|
-
* 判据:项目里有人定义了 mountScene,且**场景目录之外没有任何调用点**,同时有文件在自建 items 遍历时
|
|
728
|
-
* 读 source.kind / .build() / source.slot → 报错。只看调用点不看 import:只 import 缓存变量
|
|
729
|
-
* (`import { glbCache } from './scenes/oasis/mount'`)不算接线,那种写法正是死代码的常见伴生形态。
|
|
730
|
-
*/
|
|
731
|
-
async function checkAssemblyWiring(project, mountSources, report) {
|
|
732
|
-
if (mountSources.length === 0) return;
|
|
733
|
-
const root = resolve(project);
|
|
734
|
-
const srcDir = await projectFile(root, 'src');
|
|
735
|
-
if (!(await statOrNull(srcDir))) return;
|
|
736
|
-
const files = await listFiles(srcDir, { ext: ['.ts', '.tsx', '.js', '.mjs'], recursive: true });
|
|
737
|
-
const selfLoops = [];
|
|
738
|
-
for (const file of files) {
|
|
739
|
-
const text = await readFile(file, 'utf8');
|
|
740
|
-
if (mountCallCount(text) > 0) return; // 入口接了线,装配函数不是死代码
|
|
741
|
-
const defined = (text.match(/(?:export\s+)?(?:async\s+)?function\s+mountScene\b/g) || []).length;
|
|
742
|
-
if (defined > 0) continue; // 装配函数本体不算「自建循环」
|
|
743
|
-
const iteratesItems = /for\s*\(\s*const\s+\w+\s+of\s+[\w.$]*items\b|\.items\s*\.\s*forEach\s*\(/.test(text);
|
|
744
|
-
const judgesKind = /source\s*\.\s*kind|source\s*\.\s*slot|\.build\s*\(/.test(text);
|
|
745
|
-
if (iteratesItems && judgesKind) selfLoops.push(toPosix(relative(root, file)));
|
|
746
|
-
}
|
|
747
|
-
if (selfLoops.length === 0) return;
|
|
748
|
-
report(
|
|
749
|
-
`游戏侧自己遍历 items 装配(${selfLoops.slice(0, 3).join(', ')}${selfLoops.length > 3 ? ' …' : ''}),`
|
|
750
|
-
+ '没有调用各关 mountScene 装配函数:装配函数里的 glb 分支与通用碰撞桥是死代码,'
|
|
751
|
-
+ '编辑器拖入的云资产在游戏内静默不可见(入口只装 slot 时尤其隐蔽——场景照常渲染,只有云资产缺席,'
|
|
752
|
-
+ 'build / typecheck 全绿)。修法是让入口改走 mountScene(slot 与 glb 同一条路径),'
|
|
753
|
-
+ '不是往装配函数里再补一遍分支(见第 7 步「装配是唯一入口」)',
|
|
754
|
-
);
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
/**
|
|
758
|
-
* 装配环:装配侧要能消费编辑器拖入的云资产。
|
|
759
|
-
*
|
|
760
|
-
* 判据不依赖「当前 scene.ts 里有没有 glb item」——工程接入场景编辑器后,用户随时会拖云资产进来,
|
|
761
|
-
* 转换当时没有不等于可以不带通道(实测踩过:转换时无 glb,编辑器拖入后装配环断接、游戏内静默不可见)。
|
|
762
|
-
*
|
|
763
|
-
* 判定顺序:先认真消费形态,再看有没有分支,最后识别空实现。真消费写在 if 分支还是 else 收尾
|
|
764
|
-
* 都是合法写法,因此必须先行匹配 CONSUME——否则「消费写在 else、全文无引号字面量」的形态会被误判成无分支。
|
|
765
|
-
*
|
|
766
|
-
* 判据是启发式正则:装配代码是任意代码,这里只抓「明显没消费」的形态;
|
|
767
|
-
* 最终判据仍是 Verification 9 的实拖云资产端到端(console 无 `GLB 未加载,跳过`)。
|
|
768
|
-
*/
|
|
769
|
-
function checkGlbBranch(mountSource, report, warnings) {
|
|
770
|
-
const CONSUME = /(glbMap|glbCache|getGlb\s*\(|glb\s*\.\s*get\s*\(|\.get\(\s*item\.source\.url|\.get\(\s*item\.source\?\.url|resolveSceneAssetUrl|ResourceManager\s*\.\s*get)/;
|
|
771
|
-
if (CONSUME.test(mountSource)) return;
|
|
772
|
-
|
|
773
|
-
if (!/['"]glb['"]/.test(mountSource)) {
|
|
774
|
-
report(
|
|
775
|
-
'装配侧未发现云资产消费分支:编辑器拖入的 glb 物件在游戏内静默不可见。'
|
|
776
|
-
+ '装配分支要从预载结果按 url 取模型再 clone()(见第 8 步装配环)',
|
|
777
|
-
);
|
|
778
|
-
return;
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
// 空实现:命中 kind === 'glb' 后短距离内就 return null,骗过字面量检查
|
|
782
|
-
const emptyBranch = /kind\s*===?\s*['"]glb['"][\s\S]{0,400}?\breturn\s+null\b/.test(mountSource);
|
|
783
|
-
if (emptyBranch) {
|
|
784
|
-
report(
|
|
785
|
-
'装配侧的 glb 分支是空实现(命中 kind === "glb" 后直接 return null),云资产不会被装配:'
|
|
786
|
-
+ '编辑器拖入的资产在游戏内静默不可见。装配环三段齐全——main.ts 有预载入口、'
|
|
787
|
-
+ '预载结果进 glbMap/glbCache、装配分支 get(item.source.url) 后 clone()(见第 8 步装配环)',
|
|
788
|
-
);
|
|
789
|
-
return;
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
warnings.push(
|
|
793
|
-
'装配侧出现 glb 字面量,但未识别出对预载结果的取用(glbMap/glbCache/getGlb/get(item.source.url)):'
|
|
794
|
-
+ '云资产可能仍不会被装配,请人工确认装配分支真的消费了预载结果(见第 8 步装配环)',
|
|
795
|
-
);
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
/** main.ts + 一跳相对引用:预载常拆在 `preload.ts` 一类模块里,只读 main.ts 会误报。 */
|
|
799
|
-
async function readEntryWithDeps(entryPath) {
|
|
800
|
-
const text = await readFile(entryPath, 'utf8');
|
|
801
|
-
const parts = [text];
|
|
802
|
-
const seen = new Set([entryPath]);
|
|
803
|
-
for (const match of text.matchAll(/from\s+['"](\.[^'"]+)['"]/g)) {
|
|
804
|
-
const base = resolve(dirname(entryPath), match[1]);
|
|
805
|
-
for (const candidate of [base, `${base}.ts`, join(base, 'index.ts')]) {
|
|
806
|
-
const info = await statOrNull(candidate);
|
|
807
|
-
if (!info?.isFile()) continue;
|
|
808
|
-
if (!seen.has(candidate)) {
|
|
809
|
-
seen.add(candidate);
|
|
810
|
-
parts.push(await readFile(candidate, 'utf8'));
|
|
811
|
-
}
|
|
812
|
-
break;
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
return parts;
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
/** 工程是否有 `resolveAssetUrl`;没有时不要求归一化。 */
|
|
819
|
-
async function projectHasResolveAssetUrl(project) {
|
|
820
|
-
try {
|
|
821
|
-
const { root = 'runtime/lightgame/1.0.0' } = await readJsonFile(await projectFile(project, 'game-runtime.json'));
|
|
822
|
-
const assets = await readFile(await projectFile(project, `${root}/tools/assets.mjs`), 'utf8');
|
|
823
|
-
return /\bresolveAssetUrl\b/.test(assets);
|
|
824
|
-
} catch {
|
|
825
|
-
return false;
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
/**
|
|
830
|
-
* 预载环:入口 + 结果落 map + 地址归一化 + **回补装配**。
|
|
831
|
-
*
|
|
832
|
-
* 与装配环同理,不依赖「当前有没有 glb item」——接入场景编辑器的工程随时会被拖入云资产。
|
|
833
|
-
* 前几条只证明「通道存在」;决定云资产是否可见的是回补。预载是异步的、首次装配是同步的,
|
|
834
|
-
* 装配必然跑在预载完成之前——那一刻 cache 恒空,glb item 被装配侧按 miss 跳过,此后无人重读 cache。
|
|
835
|
-
* 没有回补通道时,构建、类型检查、乃至「有预载入口 + 结果落进 map」全部通过,运行时云资产静默不可见。
|
|
836
|
-
*/
|
|
837
|
-
async function checkPreloadHints(project, mountSources, report, warnings) {
|
|
838
|
-
const mainPath = await projectFile(project, 'src/main.ts');
|
|
839
|
-
const mainStat = await statOrNull(mainPath);
|
|
840
|
-
if (!mainStat) return;
|
|
841
|
-
const parts = await readEntryWithDeps(mainPath);
|
|
842
|
-
const any = (pattern) => parts.some((part) => pattern.test(part));
|
|
843
|
-
// 一跳引用通常含 mount.ts,它的 glbCache.get 不算预载,所以入口只认加载调用、map 只认写入
|
|
844
|
-
if (!any(/(loadGlbModel|preloadGlb|preloadSceneAssets|loadGlbs|ResourceManager\s*\.\s*load|loadAsync|GLTFLoader)/)) {
|
|
845
|
-
report(
|
|
846
|
-
'src/main.ts(及其直接引用的模块)未见 glb 预载入口(loadGlbModel / preloadGlb / preloadSceneAssets / '
|
|
847
|
-
+ 'ResourceManager.load / loadAsync / GLTFLoader):装配侧拿不到模型,云资产在游戏内静默不可见。'
|
|
848
|
-
+ '用游戏已有的模型加载函数预载,启动段写成「同步装配出首帧 → 异步预载 → 预载完成后回补装配」(见第 8 步 ② 环与时序要求)',
|
|
849
|
-
);
|
|
850
|
-
return;
|
|
851
|
-
}
|
|
852
|
-
if (!any(/((glbMap|glbCache)\s*\.\s*set\(|set\(\s*url|\.set\(\s*item\.source\.url)/)) {
|
|
853
|
-
warnings.push(
|
|
854
|
-
'src/main.ts(及其直接引用的模块)出现预载调用,但未见预载结果落进 map(glbMap/glbCache):'
|
|
855
|
-
+ '装配侧按 url 取用时可能落空,请人工确认预载产物真的可被装配分支取到',
|
|
856
|
-
);
|
|
857
|
-
}
|
|
858
|
-
if (!any(/\bresolveAssetUrl\s*\(/) && await projectHasResolveAssetUrl(project)) {
|
|
859
|
-
warnings.push(
|
|
860
|
-
'src/main.ts(及其直接引用的模块)的预载未见 resolveAssetUrl:scene.ts 的地址不经 configs 导入期归一化,'
|
|
861
|
-
+ '交给加载函数前要补 resolveAssetUrl(url, { cdnBaseUrl: runtime.cdnBase })(见第 8 步 ② 环);归一化写在别处时请人工确认',
|
|
862
|
-
);
|
|
863
|
-
}
|
|
864
|
-
if (!parts.some((part) => hasGlbBackfill(part, mountSources))) {
|
|
865
|
-
report(
|
|
866
|
-
'src/main.ts(及其直接引用的模块)的预载结果没有被回补到装配:预载异步、首次装配同步,装配跑在预载完成之前,'
|
|
867
|
-
+ 'glb item 在那一刻按 cache miss 被跳过,此后无人重读(运行时云资产静默不可见,构建与类型检查全过)。'
|
|
868
|
-
+ '两条路任选——静态摆位挂在独立容器上时,预载完成后重建该容器;'
|
|
869
|
-
+ '或装配侧把 miss 的 item 记进待挂队列、预载到位后补挂(见第 8 步时序要求)',
|
|
870
|
-
);
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
/**
|
|
875
|
-
* 预载结果是否被回补到装配(见 checkPreloadHints)。三档任一成立即可:
|
|
876
|
-
* ① 预载调用点被消费,且消费回调里重新装配(`.then(() => rebuild())` / `await preload(); rebuild()`)
|
|
877
|
-
* ② 预载的 `loader.load(...)` 回调里直接挂载(onLoad 里 `scene.add` / `mount(...)`)
|
|
878
|
-
* ③ 装配侧留了待挂队列:cache miss 不丢弃,预载到位后再挂(`pending` / `deferred` / `flush`)
|
|
879
|
-
*/
|
|
880
|
-
function hasGlbBackfill(mainSource, mountSources) {
|
|
881
|
-
if (mountSources.some((source) => /(pending|deferred|待挂|补挂|flush\s*\(|drain\s*\()/.test(source))) {
|
|
882
|
-
return true;
|
|
883
|
-
}
|
|
884
|
-
// `reload|rebuild|remount` 必须带词边界:`preloadGlbs` 里含 `reload` 子串,
|
|
885
|
-
// 无边界时判据会被预载函数名本身骗过、静默放行(实测踩过)。
|
|
886
|
-
const CONSUME = /\.then\s*\(|\.catch\s*\(|\bawait\b/;
|
|
887
|
-
const BACKFILL = /(build[A-Za-z_]*\s*\(|mount[A-Za-z_]*\s*\(|\b(?:reload|rebuild|remount)\b|flush\s*\(|drain\s*\()/;
|
|
888
|
-
const PRELOAD_CALL = /(?:^|[^\w$.])(preload[A-Za-z_]*|loadGlbs|loadSceneAssets|loadCloudAssets|loadGlbModel)\s*\(/gm;
|
|
889
|
-
for (const match of mainSource.matchAll(PRELOAD_CALL)) {
|
|
890
|
-
const window = mainSource.slice(match.index, match.index + 400);
|
|
891
|
-
// `await` 写在调用名前面(`await loadGlbModel(...); mountScene()`),前看窗口里没有它。
|
|
892
|
-
const before = mainSource.slice(Math.max(0, match.index - 40), match.index);
|
|
893
|
-
if ((CONSUME.test(window) || CONSUME.test(before)) && BACKFILL.test(window)) return true;
|
|
894
|
-
}
|
|
895
|
-
for (const match of mainSource.matchAll(/\.\s*load\s*\(/g)) {
|
|
896
|
-
const window = mainSource.slice(match.index, match.index + 400);
|
|
897
|
-
if (BACKFILL.test(window)) return true;
|
|
898
|
-
}
|
|
899
|
-
return false;
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
/**
|
|
903
|
-
* ② 环:glb item 走游戏已有的模型加载函数,实参先过 `resolveAssetUrl`。
|
|
904
|
-
*
|
|
905
|
-
* Vite 的 `lightgame()` 插件只对 `configs/` 下的资源字段做导入期归一化,游戏自身模型拿到的
|
|
906
|
-
* 是归一化后的值;`scene.ts` 是源码、不在链路里,原值直接交给加载函数会指错地址。所以预载侧
|
|
907
|
-
* 补同一步 `resolveAssetUrl(url, { cdnBaseUrl: runtime.cdnBase })`,cache 的 key 仍用原值。
|
|
908
|
-
* 判据只到 warn(`checkPreloadHints`):归一化可能封装在两跳以外的模块里,静态扫描看不全。
|
|
909
|
-
* 没有 `resolveAssetUrl` 的工程,游戏自身模型路径也原样加载,scene url 同样原样传,不警告。
|
|
910
|
-
*
|
|
911
|
-
* 资产打不打进包由 ⑥ 清单环决定(`configs/scene_assets.json`),判据在 `checkSceneAssetManifest`。
|
|
912
|
-
*/
|
|
913
|
-
|
|
914
|
-
/**
|
|
915
|
-
* 清单环:`scene.ts` 的 `/Game/...` 引用必须在 `configs/scene_assets.json` 里有同 `value` 的条目。
|
|
916
|
-
*
|
|
917
|
-
* 只报警不报错:清单是**生成物**,转换完成后由构建期的 `config:export`(或编辑器退出保存)补齐,
|
|
918
|
-
* 而 `check` 跑在构建之前,此时清单缺失属于正常中间态。但它是交付前必须交代的一项——
|
|
919
|
-
* 清单缺条目时该资产会被打包静默忽略:运行时物件消失,而构建与类型检查全绿。
|
|
920
|
-
*/
|
|
921
|
-
async function checkSceneAssetManifest(root, allData, warnings) {
|
|
922
|
-
const urls = new Set();
|
|
923
|
-
for (const entry of allData) {
|
|
924
|
-
const items = Array.isArray(entry.data.items) ? entry.data.items : [];
|
|
925
|
-
for (const item of items) {
|
|
926
|
-
const url = item?.source?.kind === 'glb' && typeof item.source.url === 'string' ? item.source.url : '';
|
|
927
|
-
if (url.startsWith('/Game/')) urls.add(url);
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
if (!urls.size) return;
|
|
931
|
-
|
|
932
|
-
const manifestPath = await projectFile(root, 'configs/scene_assets.json');
|
|
933
|
-
if (!(await statOrNull(manifestPath))) {
|
|
934
|
-
warnings.push(
|
|
935
|
-
'场景含 /Game/ 云资产引用,但缺 configs/scene_assets.json 清单:清单是打包收录资产的唯一依据,'
|
|
936
|
-
+ '缺条目时这些资产会被打包静默忽略(运行时物件消失,构建与类型检查全绿)。'
|
|
937
|
-
+ '交付前跑一次 `npm run config:export`(构建期会按资源地址补齐),或在场景编辑器里退出编辑并保存一次',
|
|
938
|
-
);
|
|
939
|
-
return;
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
let manifest = {};
|
|
943
|
-
try {
|
|
944
|
-
const parsed = JSON.parse(await readFile(manifestPath, 'utf8'));
|
|
945
|
-
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) manifest = parsed;
|
|
946
|
-
} catch (error) {
|
|
947
|
-
warnings.push(`configs/scene_assets.json 不是合法 JSON(${error.message}):跑一次 \`npm run config:export\` 会按资源地址重建`);
|
|
948
|
-
return;
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
const registered = new Set(
|
|
952
|
-
Object.values(manifest)
|
|
953
|
-
.map((value) => (typeof value === 'string' ? value : value && typeof value.value === 'string' ? value.value : ''))
|
|
954
|
-
.filter(Boolean),
|
|
955
|
-
);
|
|
956
|
-
const missing = [...urls].filter((url) => !registered.has(url));
|
|
957
|
-
if (missing.length) {
|
|
958
|
-
warnings.push(
|
|
959
|
-
`configs/scene_assets.json 未登记这些场景资产(打包会静默忽略):${missing.join('、')};`
|
|
960
|
-
+ '跑一次 `npm run config:export` 即可补齐',
|
|
961
|
-
);
|
|
962
|
-
}
|
|
963
|
-
const unsafe = Object.keys(manifest).filter(
|
|
964
|
-
(key) => !key || key.includes('.') || ['__proto__', 'prototype', 'constructor'].includes(key),
|
|
965
|
-
);
|
|
966
|
-
if (unsafe.length) {
|
|
967
|
-
warnings.push(
|
|
968
|
-
`configs/scene_assets.json 的键含点号或保留字(会让 vite build 直接中断):${unsafe.join(', ')};`
|
|
969
|
-
+ '跑一次 `npm run config:export` 会按资源地址迁移成安全键',
|
|
970
|
-
);
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
async function checkDisplay(project, sceneRel, display, report, warnings) {
|
|
975
|
-
if (!display) { report(`缺少 ${DISPLAY_FILE}(编辑器打开工程的最少文件集之一)`); return; }
|
|
976
|
-
if (!isText(display.scene)) report(`${DISPLAY_FILE} 缺少 scene 字段,未显式指向 ${sceneRel}`);
|
|
977
|
-
else if (toPosix(display.scene) !== sceneRel) report(`${DISPLAY_FILE} 的 scene 字段指向 ${display.scene},与实际场景 ${sceneRel} 不一致`);
|
|
978
|
-
if (!isText(display.name)) warnings.push(`${DISPLAY_FILE} 缺少 name 字段(编辑器显示用,建议补齐)`);
|
|
979
|
-
if (!isText(display.coordSpace)) warnings.push(`${DISPLAY_FILE} 缺少 coordSpace 字段(编辑器打开工程的最少文件集之一)`);
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
async function checkBundleFreshness(project, sceneRel, warnings) {
|
|
983
|
-
const bundlePath = await projectFile(project, BUNDLE_FILE);
|
|
984
|
-
const bundleStat = await statOrNull(bundlePath);
|
|
985
|
-
if (!bundleStat) return;
|
|
986
|
-
const sceneDirAbs = dirname(await projectFile(project, sceneRel));
|
|
987
|
-
const sources = await listFiles(sceneDirAbs, { ext: ['.ts'] });
|
|
988
|
-
for (const file of sources) {
|
|
989
|
-
// scene.ts 由编辑器随时改写,不代表造型代码变化,不参与新鲜度比对。
|
|
990
|
-
if (file.endsWith('scene.ts')) continue;
|
|
991
|
-
const info = await stat(file);
|
|
992
|
-
if (info.mtimeMs > bundleStat.mtimeMs + 1000) {
|
|
993
|
-
warnings.push(`造型/槽位源码 ${toPosix(relative(resolve(project), file))} 比 ${BUNDLE_FILE} 新,bundle 可能未重打(改动造型代码后必须重打)`);
|
|
994
|
-
break;
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
export async function checkProject(project) {
|
|
1000
|
-
const root = resolve(project);
|
|
1001
|
-
const info = await stat(await projectFile(root));
|
|
1002
|
-
if (!info.isDirectory()) throw new Error('项目根必须是目录');
|
|
1003
|
-
if (!(await statOrNull(await projectFile(root, 'package.json')))) throw new Error('项目根缺少 package.json,--project 应指向游戏项目而非其上级工作区');
|
|
1004
|
-
|
|
1005
|
-
const errors = [];
|
|
1006
|
-
const warnings = [];
|
|
1007
|
-
const report = (message) => errors.push(message);
|
|
1008
|
-
const { display, scenes, primaryRel, warnings: findWarnings } = await findScenes(root);
|
|
1009
|
-
warnings.push(...findWarnings);
|
|
1010
|
-
|
|
1011
|
-
// 逐关校验:scene.ts 契约 / slots.ts 槽位 / 装配提示 / bundle 新鲜度
|
|
1012
|
-
const allData = [];
|
|
1013
|
-
const perScene = [];
|
|
1014
|
-
const unionKeys = new Set();
|
|
1015
|
-
// 各关自己定义的键(不含公共槽位模块并入的):跨关重名只对这一部分判,共享键天然全项目唯一。
|
|
1016
|
-
const localKeys = new Set();
|
|
1017
|
-
// 各关装配源码:项目级判跨端装配同构时用(见 checkAssemblyParity)
|
|
1018
|
-
const mountSources = [];
|
|
1019
|
-
// 各关装配源码 + 一跳引用:只喂 glb 分支判据(见 collectMountSource)
|
|
1020
|
-
const glbSources = [];
|
|
1021
|
-
// 各关装配包装模块与槽位键:多关卡装配覆盖判据用(见 checkLevelSlotCoverage)
|
|
1022
|
-
const levelInfo = [];
|
|
1023
|
-
for (const { path: scenePath, rel: sceneRel } of scenes) {
|
|
1024
|
-
const sceneReport = (message) => errors.push(`${sceneRel}: ${message}`);
|
|
1025
|
-
const text = await readFile(scenePath, 'utf8');
|
|
1026
|
-
let parsed;
|
|
1027
|
-
try { parsed = parseSceneSource(text); }
|
|
1028
|
-
catch (error) { throw new Error(`${sceneRel}: ${error.message}`); }
|
|
1029
|
-
const sceneWarnings = [];
|
|
1030
|
-
for (const message of validateSceneData(parsed.data, sceneWarnings)) sceneReport(message);
|
|
1031
|
-
warnings.push(...sceneWarnings.map((message) => `${sceneRel}: ${message}`));
|
|
1032
|
-
warnings.push(...lintSerialization(text, parsed.literal).map((message) => `${sceneRel}: ${message}`));
|
|
1033
|
-
|
|
1034
|
-
const slots = await checkSlots(root, sceneRel, parsed.data, sceneReport, warnings);
|
|
1035
|
-
for (const key of slots.keys) {
|
|
1036
|
-
unionKeys.add(key);
|
|
1037
|
-
}
|
|
1038
|
-
for (const key of slots.localKeys) {
|
|
1039
|
-
// 跨关重名 = 某个共享造型没走公共槽位模块。编辑器槽位注册是全局键空间(同名后到覆盖先到),
|
|
1040
|
-
// 先注册的 build 被覆盖、先转的关卡静默渲染错造型。共享造型的正解是 src/scenes/shared/slots.ts。
|
|
1041
|
-
if (localKeys.has(key)) report(`槽位 ${key} 在多个关卡各自定义(跨关复用的造型应放进公共槽位模块 src/scenes/shared/slots.ts,各关引用同一份定义)`);
|
|
1042
|
-
localKeys.add(key);
|
|
1043
|
-
}
|
|
1044
|
-
const mount = await collectMountSource(root, sceneRel);
|
|
1045
|
-
if (mount) {
|
|
1046
|
-
mountSources.push(mount.own);
|
|
1047
|
-
glbSources.push(mount.withDeps);
|
|
1048
|
-
// 该关的装配包装模块:多关卡槽位覆盖判据用它判断入口接了哪几关(见 checkLevelSlotCoverage)
|
|
1049
|
-
levelInfo.push({
|
|
1050
|
-
rel: sceneRel,
|
|
1051
|
-
usedSlots: slots.used,
|
|
1052
|
-
providedKeys: slots.keys,
|
|
1053
|
-
mountAbs: mount.files.find((file) => /mount\.ts$/.test(file)) ?? mount.files[0],
|
|
1054
|
-
});
|
|
1055
|
-
}
|
|
1056
|
-
await checkBundleFreshness(root, sceneRel, warnings);
|
|
1057
|
-
allData.push({ rel: sceneRel, data: parsed.data });
|
|
1058
|
-
const items = Array.isArray(parsed.data.items) ? parsed.data.items : [];
|
|
1059
|
-
perScene.push({
|
|
1060
|
-
scene: sceneRel,
|
|
1061
|
-
itemCount: items.length,
|
|
1062
|
-
glbCount: items.filter((item) => item.source?.kind === 'glb').length,
|
|
1063
|
-
slotCount: slots.keys.size,
|
|
1064
|
-
});
|
|
1065
|
-
}
|
|
1066
|
-
|
|
1067
|
-
// 项目级判据(跑一次):装配侧 glb 环 + 碰撞桥消费、装配接线、多关卡覆盖、预载环、清单环
|
|
1068
|
-
// ② 环随预载环一起判(checkPreloadHints 的 resolveAssetUrl 警告)
|
|
1069
|
-
const allItems = allData.flatMap((entry) => (Array.isArray(entry.data.items) ? entry.data.items : []));
|
|
1070
|
-
checkAssemblyHints(mountSources, glbSources, allItems.some((item) => item.solid !== false), report, warnings);
|
|
1071
|
-
await checkAssemblyWiring(root, mountSources, report);
|
|
1072
|
-
await checkLevelSlotCoverage(root, levelInfo, report, warnings);
|
|
1073
|
-
await checkPreloadHints(root, mountSources, report, warnings);
|
|
1074
|
-
|
|
1075
|
-
// bundle 是项目级一份:按全项目槽位键并集对账
|
|
1076
|
-
const bundle = await checkBundle(root, allData.map((entry) => entry.data), unionKeys, report, warnings);
|
|
1077
|
-
if (bundle) checkAssemblyParity(mountSources, bundle.rootOffsets, report);
|
|
1078
|
-
await checkDisplay(root, primaryRel, display, report, warnings);
|
|
1079
|
-
await checkSceneAssetManifest(root, allData, warnings);
|
|
1080
|
-
|
|
1081
|
-
return {
|
|
1082
|
-
ok: errors.length === 0,
|
|
1083
|
-
errors,
|
|
1084
|
-
warnings,
|
|
1085
|
-
scene: primaryRel,
|
|
1086
|
-
scenes: allData.map((entry) => entry.rel),
|
|
1087
|
-
sceneCount: allData.length,
|
|
1088
|
-
perScene,
|
|
1089
|
-
itemCount: perScene.reduce((sum, entry) => sum + entry.itemCount, 0),
|
|
1090
|
-
glbCount: perScene.reduce((sum, entry) => sum + entry.glbCount, 0),
|
|
1091
|
-
slotCount: unionKeys.size,
|
|
1092
|
-
bundle: bundle ? bundle.files : null,
|
|
1093
|
-
bundleChecked: Boolean(bundle),
|
|
1094
|
-
};
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1097
|
-
/* ------------------------------------------------------------------ *
|
|
1098
|
-
* 标记(本地接入记录,不代表线上编辑器验收)
|
|
1099
|
-
* ------------------------------------------------------------------ */
|
|
1100
|
-
|
|
1101
|
-
export async function markProject(project) {
|
|
1102
|
-
const result = await checkProject(project);
|
|
1103
|
-
if (!result.ok) throw new Error(`场景编辑器接入检查未通过:\n${formatErrors(result.errors)}`);
|
|
1104
|
-
await checkFeatureVersion(project, 'sceneeditor');
|
|
1105
|
-
const path = 'SPEC/plan/dev-config.json';
|
|
1106
|
-
const target = await projectFile(project, path);
|
|
1107
|
-
let config = {};
|
|
1108
|
-
let previous = null;
|
|
1109
|
-
try {
|
|
1110
|
-
previous = await readFile(target, 'utf8');
|
|
1111
|
-
config = JSON.parse(previous);
|
|
1112
|
-
if (!config || typeof config !== 'object' || Array.isArray(config)) throw new Error('期望一个对象');
|
|
1113
|
-
} catch (error) {
|
|
1114
|
-
if (error.code !== 'ENOENT') throw new Error(`无法合并 ${path},已保留原内容: ${error.message}`);
|
|
1115
|
-
}
|
|
1116
|
-
config[MARKER] = true;
|
|
1117
|
-
config[SCENE_MARKER] = result.scene;
|
|
1118
|
-
if (result.sceneCount > 1) config[SCENES_MARKER] = result.scenes;
|
|
1119
|
-
else delete config[SCENES_MARKER];
|
|
1120
|
-
const next = `${JSON.stringify(config, null, 2)}\n`;
|
|
1121
|
-
if (next !== previous) {
|
|
1122
|
-
await mkdir(dirname(target), { recursive: true });
|
|
1123
|
-
const temporary = join(dirname(target), `.scene-editor-${randomUUID()}.tmp`);
|
|
1124
|
-
await writeFile(temporary, next, { flag: 'wx' });
|
|
1125
|
-
if (previous !== null) {
|
|
1126
|
-
const current = await readFile(target, 'utf8').catch((error) => { if (error.code === 'ENOENT') return null; throw error; });
|
|
1127
|
-
if (current !== previous) {
|
|
1128
|
-
await unlink(temporary).catch(() => {});
|
|
1129
|
-
throw new Error(`更新期间 ${path} 被其他改动修改,已保留原文件,请重试`);
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
await rename(temporary, target);
|
|
1133
|
-
}
|
|
1134
|
-
const feature = await updateFeatureVersion(project, 'sceneeditor', { ifPresent: true });
|
|
1135
|
-
return { ...result, changed: next !== previous, featureVersion: feature ? feature.currentVersion : null };
|
|
1136
|
-
}
|
|
1137
|
-
|
|
1138
|
-
/* ------------------------------------------------------------------ *
|
|
1139
|
-
* CLI
|
|
1140
|
-
* ------------------------------------------------------------------ */
|
|
1141
|
-
|
|
1142
|
-
// 错误行统一带前缀,与 warning 的 `警告: ` 对称——调用方靠前缀判级别,不用去猜 `- ` 是什么。
|
|
1143
|
-
const formatErrors = (errors) => errors.map((line) => `[场景编辑器] 错误: ${line}`).join('\n');
|
|
1144
|
-
|
|
1145
|
-
export async function runCli(args = process.argv.slice(2)) {
|
|
1146
|
-
const command = args[0];
|
|
1147
|
-
const option = args.indexOf('--project');
|
|
1148
|
-
if (!['check', 'mark'].includes(command) || option < 0 || !args[option + 1] || args[option + 1].startsWith('--') || args.length !== 3) {
|
|
1149
|
-
throw new Error('用法: node scene-editor.mjs check|mark --project <游戏项目目录>');
|
|
1150
|
-
}
|
|
1151
|
-
const project = resolve(args[option + 1]);
|
|
1152
|
-
const result = command === 'mark' ? await markProject(project) : await checkProject(project);
|
|
1153
|
-
|
|
1154
|
-
console.log(`[场景编辑器] skill 版本 ${await readSkillVersion() ?? '未知'}`);
|
|
1155
|
-
console.log(`[场景编辑器] 检查项目: ${project}`);
|
|
1156
|
-
console.log(
|
|
1157
|
-
`[场景编辑器] 场景 ${result.scene}` +
|
|
1158
|
-
(result.sceneCount > 1 ? `(共 ${result.sceneCount} 关:${result.scenes.join('、')})` : '') +
|
|
1159
|
-
`:items ${result.itemCount} 条(glb ${result.glbCount} 条),slots.ts 槽位 ${result.slotCount} 个`
|
|
1160
|
-
);
|
|
1161
|
-
if (result.sceneCount > 1) {
|
|
1162
|
-
for (const entry of result.perScene) {
|
|
1163
|
-
console.log(`[场景编辑器] ${entry.scene}:items ${entry.itemCount} 条(glb ${entry.glbCount} 条),槽位 ${entry.slotCount} 个`);
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
if (result.bundle) {
|
|
1167
|
-
for (const entry of result.bundle) console.log(`[场景编辑器] bundle 槽位 ${entry.slot}: mesh ${entry.meshes}`);
|
|
1168
|
-
}
|
|
1169
|
-
for (const warning of result.warnings) console.log(`[场景编辑器] 警告: ${warning}`);
|
|
1170
|
-
if (!result.ok) console.error(formatErrors(result.errors));
|
|
1171
|
-
// 汇总行无条件打印:一次运行的结论落在一行里,不靠「有没有打印通过横幅」反推。
|
|
1172
|
-
console.log(
|
|
1173
|
-
`[场景编辑器] 检查结果: ${result.errors.length} error / ${result.warnings.length} warning —— ${result.ok ? '通过' : '未通过'}`
|
|
1174
|
-
);
|
|
1175
|
-
if (!result.ok) {
|
|
1176
|
-
process.exitCode = 1;
|
|
1177
|
-
return result;
|
|
1178
|
-
}
|
|
1179
|
-
const scope = result.bundleChecked ? '契约检查与 bundle 三查通过' : '契约检查通过(本次未执行 bundle 三查:场景无 slot 物件或项目未安装 three)';
|
|
1180
|
-
const featureNote = result.featureVersion ? `功能版本 ${result.featureVersion} 已写入 version/project_feature_version.json` : '工程没有 version/craft_feature_version.json,未写功能版本';
|
|
1181
|
-
console.log(`[场景编辑器] ${scope}${command === 'mark' ? `,接入标记已写入 SPEC/plan/dev-config.json,${featureNote}(本地记录,线上编辑保存仍需实际编辑器验收)` : ';线上编辑器验收需另行执行'}`);
|
|
1182
|
-
return result;
|
|
1183
|
-
}
|
|
1184
|
-
|
|
1185
|
-
if (process.argv[1] && import.meta.url === pathToFileURL(resolve(process.argv[1])).href) {
|
|
1186
|
-
runCli().catch((error) => { console.error(`[场景编辑器] ${error.message}`); process.exitCode = 1; });
|
|
1187
|
-
}
|