@craft_eco/craft-mcp 0.1.22 → 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.
Files changed (614) hide show
  1. package/README.md +28 -7
  2. package/bin/craft-mcp.mjs +10 -2
  3. package/dist-server/game-workflow/bundle-files.mjs +43 -0
  4. package/dist-server/game-workflow/engines.mjs +13 -6
  5. package/dist-server/game-workflow/project-bundles.mjs +90 -0
  6. package/dist-server/game-workflow/project-context.mjs +91 -0
  7. package/dist-server/game-workflow/projects.mjs +16 -4
  8. package/dist-server/integrations/config.mjs +71 -0
  9. package/dist-server/integrations/files.mjs +54 -0
  10. package/dist-server/integrations/hosts.mjs +30 -0
  11. package/dist-server/integrations/install.mjs +86 -0
  12. package/dist-server/integrations/runtime.mjs +71 -0
  13. package/dist-server/mcp/server.mjs +13 -9
  14. package/dist-server/preview/preview-launcher.mjs +9 -2
  15. package/dist-server/preview/preview-start.mjs +2 -2
  16. package/package.json +10 -1
  17. package/resources/craft-create/SKILL.md +14 -0
  18. package/resources/craft-game-maker/SKILL.md +77 -71
  19. package/resources/craft-game-maker/js.md +10 -10
  20. package/resources/craft-game-maker/js3d.md +13 -13
  21. package/resources/game_visual_qa.mjs +1149 -1149
  22. package/resources/js/bundle.json +93 -0
  23. package/resources/js/context/AGENTS.md +15 -102
  24. package/resources/js/context/knowledge/AigcWiring.md +5 -196
  25. package/resources/js/context/knowledge/AssetUrl.md +5 -20
  26. package/resources/js/context/knowledge/Layout.md +7 -0
  27. package/resources/js/context/knowledge/Lifecycle.md +6 -27
  28. package/resources/js/context/skills/aigc-generate/SKILL.md +6 -141
  29. package/resources/js/context/skills/asset-search/SKILL.md +5 -62
  30. package/resources/js/context/skills/asset-search/references/resource-config.md +9 -0
  31. package/resources/js/context/skills/export-config/SKILL.md +7 -19
  32. package/resources/js/context/skills/export-config/scripts/export-config.mjs +3 -45
  33. package/resources/js/context/skills/index.json +30 -0
  34. package/resources/js/context/skills/visual-qa/SKILL.md +6 -28
  35. package/resources/js/project/README.md +4 -96
  36. package/resources/js/project/package.json +1 -2
  37. package/resources/js/project/scripts/config-export/panel-resource-path.mjs +106 -0
  38. package/resources/js/{context/skills/export-config/scripts → project/scripts/config-export}/sync-asset-controls.mjs +1 -37
  39. package/resources/js/project/scripts/config-export.mjs +10 -34
  40. package/resources/js3d/bundle.json +104 -0
  41. package/resources/js3d/context/AGENTS.md +16 -85
  42. package/resources/js3d/context/knowledge/AigcWiring.md +9 -0
  43. package/resources/js3d/context/knowledge/AssetUrl.md +9 -0
  44. package/resources/js3d/context/knowledge/CodingGuide/Pitfalls.md +9 -67
  45. package/resources/js3d/context/knowledge/Layout.md +7 -0
  46. package/resources/js3d/context/knowledge/Runtime.md +5 -30
  47. package/resources/js3d/context/skills/aigc-integration/SKILL.md +6 -164
  48. package/resources/js3d/context/skills/asset-search/SKILL.md +5 -171
  49. package/resources/js3d/context/skills/asset-search/references/resource-config.md +6 -94
  50. package/resources/js3d/context/skills/asset-usage-audit/SKILL.md +6 -82
  51. package/resources/js3d/context/skills/export-config/SKILL.md +7 -11
  52. package/resources/js3d/context/skills/export-config/scripts/export-config.mjs +3 -55
  53. package/resources/js3d/context/skills/index.json +42 -0
  54. package/resources/js3d/context/skills/performance-audit/SKILL.md +8 -153
  55. package/resources/js3d/context/skills/visual-qa/SKILL.md +14 -0
  56. package/resources/js3d/project/README.md +4 -103
  57. package/resources/js3d/project/package.json +1 -2
  58. package/resources/js3d/project/scripts/config-export/panel-resource-path.mjs +106 -0
  59. package/resources/js3d/{context/skills/export-config/scripts → project/scripts/config-export}/sync-scene-assets.mjs +3 -28
  60. package/resources/js3d/project/scripts/config-export.mjs +12 -34
  61. package/vendor/agent-cli/dist/src/artifacts/build-failure.d.ts +8 -0
  62. package/vendor/agent-cli/dist/src/artifacts/build-failure.d.ts.map +1 -0
  63. package/vendor/agent-cli/dist/src/artifacts/build-failure.js +39 -0
  64. package/vendor/agent-cli/dist/src/artifacts/build-failure.js.map +1 -0
  65. package/vendor/agent-cli/dist/src/artifacts/dependency-toolchain.d.ts +5 -0
  66. package/vendor/agent-cli/dist/src/artifacts/dependency-toolchain.d.ts.map +1 -0
  67. package/vendor/agent-cli/dist/src/artifacts/dependency-toolchain.js +45 -0
  68. package/vendor/agent-cli/dist/src/artifacts/dependency-toolchain.js.map +1 -0
  69. package/vendor/agent-cli/dist/src/artifacts/preinstalled-dependencies.d.ts.map +1 -1
  70. package/vendor/agent-cli/dist/src/artifacts/preinstalled-dependencies.js +71 -6
  71. package/vendor/agent-cli/dist/src/artifacts/preinstalled-dependencies.js.map +1 -1
  72. package/vendor/agent-cli/dist/src/artifacts/prepare.d.ts +2 -0
  73. package/vendor/agent-cli/dist/src/artifacts/prepare.d.ts.map +1 -1
  74. package/vendor/agent-cli/dist/src/artifacts/prepare.js +7 -2
  75. package/vendor/agent-cli/dist/src/artifacts/prepare.js.map +1 -1
  76. package/vendor/agent-cli/dist/src/artifacts/process-artifacts.d.ts +2 -0
  77. package/vendor/agent-cli/dist/src/artifacts/process-artifacts.d.ts.map +1 -1
  78. package/vendor/agent-cli/dist/src/artifacts/process-artifacts.js +27 -16
  79. package/vendor/agent-cli/dist/src/artifacts/process-artifacts.js.map +1 -1
  80. package/vendor/agent-cli/dist/src/artifacts/scene-asset-references.d.ts +14 -0
  81. package/vendor/agent-cli/dist/src/artifacts/scene-asset-references.d.ts.map +1 -0
  82. package/vendor/agent-cli/dist/src/artifacts/scene-asset-references.js +119 -0
  83. package/vendor/agent-cli/dist/src/artifacts/scene-asset-references.js.map +1 -0
  84. package/vendor/agent-cli/dist/src/artifacts/static.d.ts.map +1 -1
  85. package/vendor/agent-cli/dist/src/artifacts/static.js +20 -6
  86. package/vendor/agent-cli/dist/src/artifacts/static.js.map +1 -1
  87. package/vendor/agent-cli/dist/src/cli/process-protocol.d.ts.map +1 -1
  88. package/vendor/agent-cli/dist/src/cli/process-protocol.js +24 -2
  89. package/vendor/agent-cli/dist/src/cli/process-protocol.js.map +1 -1
  90. package/vendor/agent-cli/dist/src/cli/process-steering.d.ts +21 -0
  91. package/vendor/agent-cli/dist/src/cli/process-steering.d.ts.map +1 -0
  92. package/vendor/agent-cli/dist/src/cli/process-steering.js +66 -0
  93. package/vendor/agent-cli/dist/src/cli/process-steering.js.map +1 -0
  94. package/vendor/agent-cli/dist/src/context/user-skill-bundle.js +1 -1
  95. package/vendor/agent-cli/dist/src/context/user-skill-bundle.js.map +1 -1
  96. package/vendor/agent-cli/dist/src/index.d.ts +4 -1
  97. package/vendor/agent-cli/dist/src/index.d.ts.map +1 -1
  98. package/vendor/agent-cli/dist/src/index.js +3 -0
  99. package/vendor/agent-cli/dist/src/index.js.map +1 -1
  100. package/vendor/agent-cli/dist/src/protocol/messages/messages.gen.d.ts +31 -1
  101. package/vendor/agent-cli/dist/src/protocol/messages/messages.gen.d.ts.map +1 -1
  102. package/vendor/agent-cli/dist/src/protocol/messages/messages.gen.js +19 -1
  103. package/vendor/agent-cli/dist/src/protocol/messages/messages.gen.js.map +1 -1
  104. package/vendor/agent-cli/dist/src/session/client.d.ts +10 -0
  105. package/vendor/agent-cli/dist/src/session/client.d.ts.map +1 -1
  106. package/vendor/agent-cli/dist/src/session/client.js +16 -5
  107. package/vendor/agent-cli/dist/src/session/client.js.map +1 -1
  108. package/vendor/agent-cli/dist/src/session/link-session.d.ts +3 -0
  109. package/vendor/agent-cli/dist/src/session/link-session.d.ts.map +1 -1
  110. package/vendor/agent-cli/dist/src/session/link-session.js +17 -1
  111. package/vendor/agent-cli/dist/src/session/link-session.js.map +1 -1
  112. package/vendor/agent-cli/dist/src/session/process-observability.d.ts +3 -0
  113. package/vendor/agent-cli/dist/src/session/process-observability.d.ts.map +1 -1
  114. package/vendor/agent-cli/dist/src/session/process-observability.js +11 -0
  115. package/vendor/agent-cli/dist/src/session/process-observability.js.map +1 -1
  116. package/vendor/agent-cli/dist/src/session/process-request.d.ts +3 -2
  117. package/vendor/agent-cli/dist/src/session/process-request.d.ts.map +1 -1
  118. package/vendor/agent-cli/dist/src/session/process-request.js +27 -9
  119. package/vendor/agent-cli/dist/src/session/process-request.js.map +1 -1
  120. package/vendor/agent-cli/dist/src/session/run-start-body.d.ts +2 -0
  121. package/vendor/agent-cli/dist/src/session/run-start-body.d.ts.map +1 -1
  122. package/vendor/agent-cli/dist/src/session/run-start-body.js +9 -3
  123. package/vendor/agent-cli/dist/src/session/run-start-body.js.map +1 -1
  124. package/vendor/agent-cli/dist/src/session/run-steer.d.ts +42 -0
  125. package/vendor/agent-cli/dist/src/session/run-steer.d.ts.map +1 -0
  126. package/vendor/agent-cli/dist/src/session/run-steer.js +205 -0
  127. package/vendor/agent-cli/dist/src/session/run-steer.js.map +1 -0
  128. package/vendor/agent-cli/dist/src/shared/types.d.ts +10 -0
  129. package/vendor/agent-cli/dist/src/shared/types.d.ts.map +1 -1
  130. package/vendor/agent-cli/dist/src/tools/context-program-receipt.d.ts +21 -0
  131. package/vendor/agent-cli/dist/src/tools/context-program-receipt.d.ts.map +1 -0
  132. package/vendor/agent-cli/dist/src/tools/context-program-receipt.js +102 -0
  133. package/vendor/agent-cli/dist/src/tools/context-program-receipt.js.map +1 -0
  134. package/vendor/agent-cli/dist/src/tools/context-program.d.ts.map +1 -1
  135. package/vendor/agent-cli/dist/src/tools/context-program.js +3 -0
  136. package/vendor/agent-cli/dist/src/tools/context-program.js.map +1 -1
  137. package/resources/js/context/.role/AGENTS_DESIGN.md +0 -9
  138. package/resources/js/context/agents/aigc-asset.md +0 -168
  139. package/resources/js/context/knowledge/AigcEnabled.md +0 -49
  140. package/resources/js/context/knowledge/FrontendComponents.md +0 -17
  141. package/resources/js/context/knowledge/MobileAdaptation.md +0 -73
  142. package/resources/js/context/knowledge/MobileAdapted.md +0 -36
  143. package/resources/js/context/knowledge/Multiplayer/GameplaySystemKnowledge.md +0 -114
  144. package/resources/js/context/knowledge/Multiplayer/OverviewKnowledge.md +0 -115
  145. package/resources/js/context/knowledge/Multiplayer/StateSyncKnowledge.md +0 -392
  146. package/resources/js/context/knowledge/PlatformServices.md +0 -190
  147. package/resources/js/context/knowledge/ProjectDisplayConfig.md +0 -35
  148. package/resources/js/context/knowledge/Subsystems/Optional/MultiplayerManagerKnowledge.md +0 -242
  149. package/resources/js/context/knowledge/Ui.md +0 -11
  150. package/resources/js/context/knowledge/UiEditorCompat.md +0 -21
  151. package/resources/js/context/rules/MultiplayerCapability.md +0 -23
  152. package/resources/js/context/rules/MultiplayerRoomEntryUX.md +0 -63
  153. package/resources/js/context/rules/PlatformBoundaryModules.md +0 -44
  154. package/resources/js/context/rules/preview_ready.md +0 -8
  155. package/resources/js/context/skills/aigc-generate/knowledge/audio.md +0 -39
  156. package/resources/js/context/skills/aigc-generate/knowledge/batch-replace.md +0 -26
  157. package/resources/js/context/skills/aigc-generate/knowledge/character2d.md +0 -132
  158. package/resources/js/context/skills/aigc-generate/knowledge/non-stepwise-aigc.md +0 -53
  159. package/resources/js/context/skills/aigc-generate/knowledge/texture-prop.md +0 -52
  160. package/resources/js/context/skills/aigc-generate/knowledge/texture-scene.md +0 -191
  161. package/resources/js/context/skills/aigc-generate/knowledge/texture-ui.md +0 -55
  162. package/resources/js/context/skills/asset-search/scripts/asset_display.mjs +0 -62
  163. package/resources/js/context/skills/asset-search/scripts/config.json +0 -5
  164. package/resources/js/context/skills/asset-search/scripts/provided_assets.mjs +0 -125
  165. package/resources/js/context/skills/asset-search/scripts/search.mjs +0 -760
  166. package/resources/js/context/skills/asset-search/scripts/sprite_source_materializer.mjs +0 -657
  167. package/resources/js/context/skills/asset-search/strategies/anim2d.md +0 -42
  168. package/resources/js/context/skills/asset-search/strategies/audio.md +0 -34
  169. package/resources/js/context/skills/asset-search/strategies/effect2d.md +0 -31
  170. package/resources/js/context/skills/asset-search/strategies/texture-prop.md +0 -22
  171. package/resources/js/context/skills/asset-search/strategies/ui-common.md +0 -40
  172. package/resources/js/context/skills/asset-search/strategies/ui-style.md +0 -28
  173. package/resources/js/context/skills/export-config/scripts/translate-asset-titles.mjs +0 -161
  174. package/resources/js/context/skills/lightgame-runtime-adapt/SKILL.md +0 -93
  175. package/resources/js/context/skills/lightgame-runtime-adapt/project/game-runtime.json +0 -7
  176. package/resources/js/context/skills/lightgame-runtime-adapt/project/package.json +0 -22
  177. package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/identity/qq-ai-game-sdk.min.js +0 -5
  178. package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/identity/qq-session.mjs +0 -208
  179. package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/identity/shared.mjs +0 -37
  180. package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/platform-capture-video.mjs +0 -227
  181. package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/platform-service.d.mts +0 -31
  182. package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/platform-service.mjs +0 -272
  183. package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/platform.d.mts +0 -79
  184. package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/platform.mjs +0 -29
  185. package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/release.json +0 -22
  186. package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tooling/cli.mjs +0 -16
  187. package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tooling/project.d.mts +0 -4
  188. package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tooling/project.mjs +0 -50
  189. package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tooling/vite.d.mts +0 -3
  190. package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tooling/vite.mjs +0 -72
  191. package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tools/assets.d.mts +0 -24
  192. package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tools/assets.mjs +0 -2
  193. package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tools/astc.d.mts +0 -10
  194. package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tools/astc.mjs +0 -1
  195. package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/config-export.mjs +0 -37
  196. package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/refresh-runtime.mjs +0 -50
  197. package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/cli.mjs +0 -20
  198. package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/config.d.mts +0 -19
  199. package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/config.mjs +0 -1
  200. package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/installed.json +0 -6
  201. package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/project.d.mts +0 -6
  202. package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/project.mjs +0 -77
  203. package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/vite.d.mts +0 -2
  204. package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/vite.mjs +0 -34
  205. package/resources/js/context/skills/lightgame-runtime-adapt/project/src/display/ui-stage.ts +0 -156
  206. package/resources/js/context/skills/lightgame-runtime-adapt/project/src/display/viewport.ts +0 -249
  207. package/resources/js/context/skills/lightgame-runtime-adapt/project/src/main.ts +0 -87
  208. package/resources/js/context/skills/lightgame-runtime-adapt/project/src/platform.ts +0 -2
  209. package/resources/js/context/skills/lightgame-runtime-adapt/project/src/screenUi.ts +0 -185
  210. package/resources/js/context/skills/lightgame-runtime-adapt/project/src/style.css +0 -294
  211. package/resources/js/context/skills/lightgame-runtime-adapt/project/tsconfig.json +0 -20
  212. package/resources/js/context/skills/lightgame-runtime-adapt/project/vite.config.ts +0 -5
  213. package/resources/js/context/skills/lightgame-runtime-adapt/scripts/install-template.mjs +0 -159
  214. package/resources/js/context/skills/mobile-adaptation/SKILL.md +0 -277
  215. package/resources/js/context/skills/mobile-adaptation/assets/example/src/input/input-config.json +0 -50
  216. package/resources/js/context/skills/mobile-adaptation/assets/example/src/input/input-layer.ts +0 -862
  217. package/resources/js/context/skills/mobile-adaptation/assets/example/src/input/input-platform.ts +0 -92
  218. package/resources/js/context/skills/mobile-adaptation/assets/example/src/input/input-primitives.ts +0 -254
  219. package/resources/js/context/skills/mobile-adaptation/assets/example/src/input/look-pad.ts +0 -245
  220. package/resources/js/context/skills/mobile-adaptation/assets/example/src/ui/touch-controls.css +0 -135
  221. package/resources/js/context/skills/mobile-adaptation/references/input-config.md +0 -342
  222. package/resources/js/context/skills/mobile-adaptation/references/verification.md +0 -140
  223. package/resources/js/context/skills/mobile-adaptation/references/web-audio.md +0 -11
  224. package/resources/js/context/skills/mobile-compat-qa/SKILL.md +0 -53
  225. package/resources/js/context/skills/mobile-compat-qa/references/startup-diagnosis.md +0 -23
  226. package/resources/js/context/skills/mobile-compat-qa/references/web-lifecycle.md +0 -20
  227. package/resources/js/context/skills/mobile-compat-qa/references/web-performance.md +0 -19
  228. package/resources/js/context/skills/optimization-suggestions/SKILL.md +0 -89
  229. package/resources/js/context/skills/platform-services/SKILL.md +0 -101
  230. package/resources/js/context/skills/platform-services/assets/modules/MultiplayerManager.ts +0 -465
  231. package/resources/js/context/skills/platform-services/assets/modules/eventBus.ts +0 -57
  232. package/resources/js/context/skills/platform-services/assets/modules/identity/qq-ai-game-sdk.min.js +0 -5
  233. package/resources/js/context/skills/platform-services/assets/modules/identity/qq-session.mjs +0 -208
  234. package/resources/js/context/skills/platform-services/assets/modules/identity/shared.mjs +0 -37
  235. package/resources/js/context/skills/platform-services/assets/modules/leaderboard.d.mts +0 -39
  236. package/resources/js/context/skills/platform-services/assets/modules/leaderboard.mjs +0 -1
  237. package/resources/js/context/skills/platform-services/assets/modules/log.ts +0 -35
  238. package/resources/js/context/skills/platform-services/assets/modules/multiplayer/clockSync.ts +0 -61
  239. package/resources/js/context/skills/platform-services/assets/modules/multiplayer/dsClient.ts +0 -52
  240. package/resources/js/context/skills/platform-services/assets/modules/multiplayer/payloadCodec.ts +0 -30
  241. package/resources/js/context/skills/platform-services/assets/modules/multiplayer/roomHttp.ts +0 -89
  242. package/resources/js/context/skills/platform-services/assets/modules/multiplayer/types.ts +0 -47
  243. package/resources/js/context/skills/platform-services/assets/modules/platform-service.d.mts +0 -31
  244. package/resources/js/context/skills/platform-services/assets/modules/platform-service.mjs +0 -272
  245. package/resources/js/context/skills/platform-services/assets/modules/save.d.mts +0 -49
  246. package/resources/js/context/skills/platform-services/assets/modules/save.mjs +0 -1
  247. package/resources/js/context/skills/platform-services/assets/scaffold/ds/main.mjs +0 -7
  248. package/resources/js/context/skills/platform-services/assets/scaffold/ds/rooms/SyncRoom.mjs +0 -264
  249. package/resources/js/context/skills/platform-services/assets/scaffold/ds/rooms/syncSchema.mjs +0 -39
  250. package/resources/js/context/skills/platform-services/references/SERVER_GUIDE.md +0 -139
  251. package/resources/js/context/skills/platform-services/references/api_reference.md +0 -18
  252. package/resources/js/context/skills/platform-services/references/leaderboard_playbook.md +0 -96
  253. package/resources/js/context/skills/platform-services/scripts/install.mjs +0 -148
  254. package/resources/js/context/skills/resolution-adaptation/SKILL.md +0 -47
  255. package/resources/js/context/skills/resolution-adaptation/assets/display/ui-stage.ts +0 -156
  256. package/resources/js/context/skills/resolution-adaptation/assets/display/viewport.ts +0 -249
  257. package/resources/js/context/skills/resolution-adaptation/assets/example/main.ts +0 -98
  258. package/resources/js/context/skills/resolution-adaptation/assets/example/ui-tokens.css +0 -200
  259. package/resources/js/context/skills/resolution-adaptation/references/audit.md +0 -31
  260. package/resources/js/context/skills/resolution-adaptation/references/device-safe-area.md +0 -40
  261. package/resources/js/context/skills/resolution-adaptation/references/game-ui-occlusion.md +0 -18
  262. package/resources/js/context/skills/resolution-adaptation/references/layout-rules.md +0 -15
  263. package/resources/js/context/skills/resolution-adaptation/references/troubleshooting.md +0 -34
  264. package/resources/js/context/skills/resolution-adaptation/references/viewport-api.md +0 -38
  265. package/resources/js/context/skills/resolution-adaptation/references/world-resize.md +0 -55
  266. package/resources/js/context/skills/resolution-adaptation/scripts/aspect_audit.mjs +0 -448
  267. package/resources/js/context/skills/scene-editor-compat/SKILL.md +0 -94
  268. package/resources/js/context/skills/scene-editor-compat/assets/example/localcraft.assets.json +0 -13
  269. package/resources/js/context/skills/scene-editor-compat/assets/example/localcraft.scene-editor.json +0 -6
  270. package/resources/js/context/skills/scene-editor-compat/assets/example/src/game/sceneAdapter.ts +0 -25
  271. package/resources/js/context/skills/scene-editor-compat/assets/example/src/scenes/main.scene.json +0 -18
  272. package/resources/js/context/skills/scene-editor-compat/assets/runtime/release.json +0 -7
  273. package/resources/js/context/skills/scene-editor-compat/assets/runtime/scene.d.mts +0 -42
  274. package/resources/js/context/skills/scene-editor-compat/assets/runtime/scene.mjs +0 -144
  275. package/resources/js/context/skills/scene-editor-compat/docs/contract.md +0 -330
  276. package/resources/js/context/skills/scene-editor-compat/docs/resource-sync.md +0 -64
  277. package/resources/js/context/skills/scene-editor-compat/docs/runtime-state.md +0 -28
  278. package/resources/js/context/skills/scene-editor-compat/docs/terrain-contract.md +0 -47
  279. package/resources/js/context/skills/scene-editor-compat/docs/visual-contract.md +0 -64
  280. package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/localcraft.assets.json +0 -38
  281. package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/localcraft.scene-editor.json +0 -9
  282. package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/src/game/sceneAdapter.ts +0 -59
  283. package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/src/game/sceneBlockers.ts +0 -30
  284. package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/src/game/sceneFileAssets.ts +0 -66
  285. package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/src/scenes/Main.Scene.ts +0 -20
  286. package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/src/scenes/SceneTypes.ts +0 -26
  287. package/resources/js/context/skills/scene-editor-compat/references/contract.md +0 -73
  288. package/resources/js/context/skills/scene-editor-compat/scripts/apply_scene_marker.py +0 -162
  289. package/resources/js/context/skills/scene-editor-compat/scripts/check_scene_contract.py +0 -853
  290. package/resources/js/context/skills/scene-editor-compat/scripts/check_scene_resource_urls.py +0 -173
  291. package/resources/js/context/skills/scene-editor-compat/scripts/scene-editor.mjs +0 -427
  292. package/resources/js/context/skills/scene-editor-compat/version.json +0 -1
  293. package/resources/js/context/skills/ui-editor-compat/SKILL.md +0 -48
  294. package/resources/js/context/skills/ui-editor-compat/assets/example/hud/WidgetLayout_Hud.ts +0 -35
  295. package/resources/js/context/skills/ui-editor-compat/assets/example/hud/WidgetLogic_Hud.ts +0 -74
  296. package/resources/js/context/skills/ui-editor-compat/assets/example/hud/hud.css +0 -60
  297. package/resources/js/context/skills/ui-editor-compat/assets/runtime/dom-ui.d.mts +0 -45
  298. package/resources/js/context/skills/ui-editor-compat/assets/runtime/dom-ui.mjs +0 -265
  299. package/resources/js/context/skills/ui-editor-compat/assets/runtime/release.json +0 -7
  300. package/resources/js/context/skills/ui-editor-compat/references/contract.md +0 -132
  301. package/resources/js/context/skills/ui-editor-compat/scripts/editor-contract.mjs +0 -327
  302. package/resources/js/context/skills/ui-editor-compat/scripts/project-files.mjs +0 -80
  303. package/resources/js/context/skills/ui-editor-compat/scripts/ui-editor.mjs +0 -84
  304. package/resources/js/context/skills/version-update/SKILL.md +0 -192
  305. package/resources/js/context/skills/version-update/scripts/check_runtime_refs.mjs +0 -129
  306. package/resources/js/context/skills/version-update/scripts/feature_snapshot.mjs +0 -159
  307. package/resources/js/context/skills/version-update/scripts/update_feature_version.mjs +0 -157
  308. package/resources/js/context/skills/version-update/upgrade_diffs/.gitkeep +0 -0
  309. package/resources/js/context/version/version.json +0 -1
  310. package/resources/js/project/SPEC/assist/.gitkeep +0 -0
  311. package/resources/js/project/SPEC/guide/.gitkeep +0 -0
  312. package/resources/js/project/SPEC/plan/.gitkeep +0 -0
  313. package/resources/js/project/SPEC/readme.md +0 -6
  314. package/resources/js/project/SPEC/res/.gitkeep +0 -0
  315. package/resources/js/project/SPEC/task-item/.gitkeep +0 -0
  316. package/resources/js/project/runtime/lightgame/1.0.0/platform/config.d.mts +0 -19
  317. package/resources/js/project/runtime/lightgame/1.0.0/platform/config.mjs +0 -1
  318. package/resources/js/project/runtime/lightgame/1.0.0/platform/leaderboard.d.mts +0 -39
  319. package/resources/js/project/runtime/lightgame/1.0.0/platform/leaderboard.mjs +0 -1
  320. package/resources/js/project/runtime/lightgame/1.0.0/platform/platform-capture-video.mjs +0 -227
  321. package/resources/js/project/runtime/lightgame/1.0.0/platform/platform-service.d.mts +0 -25
  322. package/resources/js/project/runtime/lightgame/1.0.0/platform/platform-service.mjs +0 -1
  323. package/resources/js/project/runtime/lightgame/1.0.0/platform/platform.d.mts +0 -79
  324. package/resources/js/project/runtime/lightgame/1.0.0/platform/platform.mjs +0 -29
  325. package/resources/js/project/runtime/lightgame/1.0.0/platform/save.d.mts +0 -49
  326. package/resources/js/project/runtime/lightgame/1.0.0/platform/save.mjs +0 -1
  327. package/resources/js/project/runtime/lightgame/1.0.0/release.json +0 -37
  328. package/resources/js/project/runtime/lightgame/1.0.0/tooling/cli.mjs +0 -2
  329. package/resources/js/project/runtime/lightgame/1.0.0/tooling/project.d.mts +0 -8
  330. package/resources/js/project/runtime/lightgame/1.0.0/tooling/project.mjs +0 -2
  331. package/resources/js/project/runtime/lightgame/1.0.0/tooling/vite.d.mts +0 -3
  332. package/resources/js/project/runtime/lightgame/1.0.0/tooling/vite.mjs +0 -8
  333. package/resources/js/project/runtime/lightgame/1.0.0/tools/assets.d.mts +0 -24
  334. package/resources/js/project/runtime/lightgame/1.0.0/tools/assets.mjs +0 -2
  335. package/resources/js/project/runtime/lightgame/1.0.0/tools/astc.d.mts +0 -10
  336. package/resources/js/project/runtime/lightgame/1.0.0/tools/astc.mjs +0 -1
  337. package/resources/js/project/runtime/lightgame/1.0.0/tools/audio.d.mts +0 -20
  338. package/resources/js/project/runtime/lightgame/1.0.0/tools/audio.mjs +0 -1
  339. package/resources/js/project/runtime/lightgame/1.0.0/tools/canvas.d.mts +0 -21
  340. package/resources/js/project/runtime/lightgame/1.0.0/tools/canvas.mjs +0 -1
  341. package/resources/js/project/runtime/lightgame/1.0.0/tools/input.d.mts +0 -17
  342. package/resources/js/project/runtime/lightgame/1.0.0/tools/input.mjs +0 -1
  343. package/resources/js/project/runtime/lightgame/1.0.0/tools/three.d.mts +0 -40
  344. package/resources/js/project/runtime/lightgame/1.0.0/tools/three.mjs +0 -1
  345. package/resources/js/project/runtime/lightgame/1.0.0/tools/ui.d.mts +0 -10
  346. package/resources/js/project/runtime/lightgame/1.0.0/tools/ui.mjs +0 -1
  347. package/resources/js/project/runtime/lightgame/1.0.0/tools/video.d.mts +0 -8
  348. package/resources/js/project/runtime/lightgame/1.0.0/tools/video.mjs +0 -1
  349. package/resources/js/project/scripts/refresh-runtime.mjs +0 -50
  350. package/resources/js/project/vendor/core-manager-js/package.json +0 -33
  351. package/resources/js/project/vendor/core-manager-js/src/.versions.json +0 -42
  352. package/resources/js/project/vendor/core-manager-js/src/CoreManagerPlugin.ts +0 -41
  353. package/resources/js/project/vendor/core-manager-js/src/assetManager/AssetRef.ts +0 -93
  354. package/resources/js/project/vendor/core-manager-js/src/assetManager/AstcFirstImageFile.ts +0 -203
  355. package/resources/js/project/vendor/core-manager-js/src/assetManager/AstcTextureLoader.ts +0 -106
  356. package/resources/js/project/vendor/core-manager-js/src/assetManager/resolveAssetUrl.test.ts +0 -25
  357. package/resources/js/project/vendor/core-manager-js/src/assetManager/resolveAssetUrl.ts +0 -21
  358. package/resources/js/project/vendor/core-manager-js/src/audioManager/AudioManager.test.ts +0 -65
  359. package/resources/js/project/vendor/core-manager-js/src/audioManager/AudioManager.ts +0 -340
  360. package/resources/js/project/vendor/core-manager-js/src/configManager/FeatureConfig.ts +0 -87
  361. package/resources/js/project/vendor/core-manager-js/src/configManager/tuneRuntime.d.mts +0 -92
  362. package/resources/js/project/vendor/core-manager-js/src/configManager/tuneRuntime.mjs +0 -271
  363. package/resources/js/project/vendor/core-manager-js/src/index.ts +0 -31
  364. package/resources/js/project/vendor/core-manager-js/src/inputManager/InputConfig.ts +0 -81
  365. package/resources/js/project/vendor/core-manager-js/src/inputManager/InputManager.test.ts +0 -43
  366. package/resources/js/project/vendor/core-manager-js/src/inputManager/InputManager.ts +0 -32
  367. package/resources/js/project/vendor/core-manager-js/src/inputManager/InputRuntime.test.ts +0 -141
  368. package/resources/js/project/vendor/core-manager-js/src/inputManager/InputRuntime.ts +0 -20
  369. package/resources/js/project/vendor/core-manager-js/src/inputManager/KeyboardProvider.ts +0 -183
  370. package/resources/js/project/vendor/core-manager-js/src/inputManager/TouchProvider.ts +0 -304
  371. package/resources/js/project/vendor/core-manager-js/src/inputManager/VirtualJoystick.ts +0 -351
  372. package/resources/js/project/vendor/core-manager-js/src/inputManager/_internal/InputManagerImpl.ts +0 -180
  373. package/resources/js/project/vendor/core-manager-js/src/inputManager/icons.b64 +0 -13
  374. package/resources/js/project/vendor/core-manager-js/src/inputManager/icons.b64.d.ts +0 -14
  375. package/resources/js/project/vendor/core-manager-js/src/inputManager/input_config.example.json +0 -68
  376. package/resources/js/project/vendor/core-manager-js/src/logManager/DebugConsole.ts +0 -433
  377. package/resources/js/project/vendor/core-manager-js/src/logManager/LogCapture.ts +0 -118
  378. package/resources/js/project/vendor/core-manager-js/src/logManager/LogManager.ts +0 -444
  379. package/resources/js/project/vendor/core-manager-js/src/logManager/ScreenCapture.ts +0 -485
  380. package/resources/js/project/vendor/core-manager-js/src/logManager/ScreenCaptureVideo.test.ts +0 -66
  381. package/resources/js/project/vendor/core-manager-js/src/logManager/ScreenCaptureVideo.ts +0 -149
  382. package/resources/js/project/vendor/core-manager-js/src/logManager/icons.b64 +0 -9
  383. package/resources/js/project/vendor/core-manager-js/src/resourceManager/AssetUrlResolver.ts +0 -29
  384. package/resources/js/project/vendor/core-manager-js/src/resourceManager/ResourceManager.test.ts +0 -88
  385. package/resources/js/project/vendor/core-manager-js/src/resourceManager/ResourceManager.ts +0 -122
  386. package/resources/js/project/vendor/core-manager-js/src/runtime.ts +0 -24
  387. package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/CharacterEntity.ts +0 -318
  388. package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/CharacterPhysicsBinding.test.ts +0 -151
  389. package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/CharacterPhysicsBinding.ts +0 -235
  390. package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/EffectComposite.test.ts +0 -98
  391. package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/EffectComposite.ts +0 -94
  392. package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/EffectEntity.ts +0 -209
  393. package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/FxManager.test.ts +0 -106
  394. package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/FxManager.ts +0 -341
  395. package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/FxRecipe.test.ts +0 -68
  396. package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/FxRecipe.ts +0 -236
  397. package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/SpriteAnimManager.test.ts +0 -22
  398. package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/SpriteAnimManager.ts +0 -29
  399. package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/SpriteEntity.test.ts +0 -197
  400. package/resources/js/project/vendor/core-manager-js/src/uiManager/DomUiContracts.ts +0 -9
  401. package/resources/js/project/vendor/core-manager-js/src/uiManager/DomUiKit.ts +0 -555
  402. package/resources/js/project/vendor/core-manager-js/src/uiManager/UIFacadePlugin.test.ts +0 -112
  403. package/resources/js/project/vendor/core-manager-js/src/uiManager/UIFacadePlugin.ts +0 -178
  404. package/resources/js/project/vendor/core-manager-js/src/uiManager/ui-base.css +0 -246
  405. package/resources/js/project/vendor/core-manager-js/src/videoManager/VideoManager.ts +0 -139
  406. package/resources/js/project/vendor/core-manager-js/tsconfig.json +0 -15
  407. package/resources/js/project/vendor/run.sh +0 -4
  408. package/resources/js/project/version/craft_feature_version.json +0 -42
  409. package/resources/js/project/version/project_feature_version.json +0 -11
  410. package/resources/js3d/context/.role/AGENTS_DESIGN.md +0 -9
  411. package/resources/js3d/context/knowledge/3D/PoseInterpolationKnowledge.md +0 -75
  412. package/resources/js3d/context/knowledge/CodingGuide/SceneEditableGuide.md +0 -42
  413. package/resources/js3d/context/knowledge/FrontendComponents.md +0 -19
  414. package/resources/js3d/context/knowledge/MobileAdaptation.md +0 -73
  415. package/resources/js3d/context/knowledge/MobileAdapted.md +0 -36
  416. package/resources/js3d/context/knowledge/Multiplayer/GameplaySystemKnowledge.md +0 -114
  417. package/resources/js3d/context/knowledge/Multiplayer/OverviewKnowledge.md +0 -117
  418. package/resources/js3d/context/knowledge/Multiplayer/StateSyncKnowledge.md +0 -430
  419. package/resources/js3d/context/knowledge/PlatformServices.md +0 -190
  420. package/resources/js3d/context/knowledge/ProjectDisplayConfig.md +0 -35
  421. package/resources/js3d/context/knowledge/SceneEditorCompat.md +0 -35
  422. package/resources/js3d/context/knowledge/StepByStep.md +0 -21
  423. package/resources/js3d/context/knowledge/Subsystems/Optional/MultiplayerManagerKnowledge.md +0 -242
  424. package/resources/js3d/context/knowledge/UiEditorCompat.md +0 -21
  425. package/resources/js3d/context/rules/MultiplayerCapability.md +0 -27
  426. package/resources/js3d/context/rules/MultiplayerRoomEntryUX.md +0 -63
  427. package/resources/js3d/context/rules/PlatformBoundaryModules.md +0 -44
  428. package/resources/js3d/context/rules/preview_ready.md +0 -8
  429. package/resources/js3d/context/skills/aigc-integration/assets/sprite-sheet-player.mjs +0 -70
  430. package/resources/js3d/context/skills/aigc-integration/callback.md +0 -77
  431. package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/README.md +0 -23
  432. package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/audio-aigc-knowledge.md +0 -38
  433. package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/character2d-aigc-knowledge.md +0 -72
  434. package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/staticmesh-aigc-knowledge.md +0 -33
  435. package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/texture-prop-aigc-knowledge.md +0 -36
  436. package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/texture-scene-aigc-knowledge.md +0 -37
  437. package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/texture-ui-aigc-knowledge.md +0 -35
  438. package/resources/js3d/context/skills/asset-search/references/sprite-sheets.md +0 -58
  439. package/resources/js3d/context/skills/asset-search/scripts/asset_display.mjs +0 -62
  440. package/resources/js3d/context/skills/asset-search/scripts/config.json +0 -235
  441. package/resources/js3d/context/skills/asset-search/scripts/manifest_pipeline.mjs +0 -905
  442. package/resources/js3d/context/skills/asset-search/scripts/preflight.mjs +0 -79
  443. package/resources/js3d/context/skills/asset-search/scripts/provided_assets.mjs +0 -74
  444. package/resources/js3d/context/skills/asset-search/scripts/search.mjs +0 -637
  445. package/resources/js3d/context/skills/asset-search/scripts/sprite_source_materializer.mjs +0 -667
  446. package/resources/js3d/context/skills/asset-search/strategies/anim2d.md +0 -42
  447. package/resources/js3d/context/skills/asset-search/strategies/effect2d.md +0 -31
  448. package/resources/js3d/context/skills/asset-usage-audit/references/case-tidewater-zoo.md +0 -89
  449. package/resources/js3d/context/skills/asset-usage-audit/references/optimization-playbook.md +0 -143
  450. package/resources/js3d/context/skills/asset-usage-audit/references/usage-model.md +0 -90
  451. package/resources/js3d/context/skills/export-config/scripts/translate-asset-titles.mjs +0 -161
  452. package/resources/js3d/context/skills/game-art-style/SKILL.md +0 -60
  453. package/resources/js3d/context/skills/game-art-style/assets/previews/cartoon.png +0 -0
  454. package/resources/js3d/context/skills/game-art-style/assets/previews/comic.png +0 -0
  455. package/resources/js3d/context/skills/game-art-style/assets/previews/cozy.png +0 -0
  456. package/resources/js3d/context/skills/game-art-style/assets/previews/cyber.png +0 -0
  457. package/resources/js3d/context/skills/game-art-style/assets/previews/horror.png +0 -0
  458. package/resources/js3d/context/skills/game-art-style/assets/previews/lowpoly.png +0 -0
  459. package/resources/js3d/context/skills/game-art-style/assets/previews/paper.png +0 -0
  460. package/resources/js3d/context/skills/game-art-style/assets/previews/voxel.png +0 -0
  461. package/resources/js3d/context/skills/game-art-style/references/art-parameters-lite.md +0 -38
  462. package/resources/js3d/context/skills/game-art-style/references/construction.md +0 -111
  463. package/resources/js3d/context/skills/game-art-style/references/materials-textures.md +0 -105
  464. package/resources/js3d/context/skills/game-art-style/references/sources.md +0 -25
  465. package/resources/js3d/context/skills/game-art-style/references/styles/cartoon.md +0 -175
  466. package/resources/js3d/context/skills/game-art-style/references/styles/comic.md +0 -168
  467. package/resources/js3d/context/skills/game-art-style/references/styles/cozy.md +0 -191
  468. package/resources/js3d/context/skills/game-art-style/references/styles/cyber.md +0 -165
  469. package/resources/js3d/context/skills/game-art-style/references/styles/horror.md +0 -173
  470. package/resources/js3d/context/skills/game-art-style/references/styles/lowpoly.md +0 -185
  471. package/resources/js3d/context/skills/game-art-style/references/styles/paper.md +0 -181
  472. package/resources/js3d/context/skills/game-art-style/references/styles/voxel.md +0 -189
  473. package/resources/js3d/context/skills/game-art-style/references/user-style-document.md +0 -88
  474. package/resources/js3d/context/skills/mobile-adaptation/SKILL.md +0 -301
  475. package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/input/input-config.json +0 -104
  476. package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/input/input-layer.ts +0 -933
  477. package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/input/input-platform.ts +0 -92
  478. package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/input/input-primitives.ts +0 -254
  479. package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/input/look-pad.ts +0 -245
  480. package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/ui/touch-controls.css +0 -257
  481. package/resources/js3d/context/skills/mobile-adaptation/references/input-config.md +0 -342
  482. package/resources/js3d/context/skills/mobile-adaptation/references/verification.md +0 -140
  483. package/resources/js3d/context/skills/mobile-adaptation/references/web-audio.md +0 -11
  484. package/resources/js3d/context/skills/mobile-compat-qa/SKILL.md +0 -53
  485. package/resources/js3d/context/skills/mobile-compat-qa/references/startup-diagnosis.md +0 -23
  486. package/resources/js3d/context/skills/mobile-compat-qa/references/web-form-input.md +0 -10
  487. package/resources/js3d/context/skills/mobile-compat-qa/references/web-lifecycle.md +0 -20
  488. package/resources/js3d/context/skills/mobile-compat-qa/references/web-performance.md +0 -19
  489. package/resources/js3d/context/skills/optimization-suggestions/SKILL.md +0 -74
  490. package/resources/js3d/context/skills/performance-audit/references/case-notes.md +0 -93
  491. package/resources/js3d/context/skills/performance-audit/references/rules.md +0 -183
  492. package/resources/js3d/context/skills/platform-services/SKILL.md +0 -101
  493. package/resources/js3d/context/skills/platform-services/assets/modules/MultiplayerManager.ts +0 -465
  494. package/resources/js3d/context/skills/platform-services/assets/modules/eventBus.ts +0 -57
  495. package/resources/js3d/context/skills/platform-services/assets/modules/identity/qq-ai-game-sdk.min.js +0 -5
  496. package/resources/js3d/context/skills/platform-services/assets/modules/identity/qq-session.mjs +0 -208
  497. package/resources/js3d/context/skills/platform-services/assets/modules/identity/shared.mjs +0 -37
  498. package/resources/js3d/context/skills/platform-services/assets/modules/leaderboard.d.mts +0 -39
  499. package/resources/js3d/context/skills/platform-services/assets/modules/leaderboard.mjs +0 -1
  500. package/resources/js3d/context/skills/platform-services/assets/modules/log.ts +0 -35
  501. package/resources/js3d/context/skills/platform-services/assets/modules/multiplayer/clockSync.ts +0 -61
  502. package/resources/js3d/context/skills/platform-services/assets/modules/multiplayer/dsClient.ts +0 -52
  503. package/resources/js3d/context/skills/platform-services/assets/modules/multiplayer/payloadCodec.ts +0 -30
  504. package/resources/js3d/context/skills/platform-services/assets/modules/multiplayer/roomHttp.ts +0 -89
  505. package/resources/js3d/context/skills/platform-services/assets/modules/multiplayer/types.ts +0 -47
  506. package/resources/js3d/context/skills/platform-services/assets/modules/platform-service.d.mts +0 -31
  507. package/resources/js3d/context/skills/platform-services/assets/modules/platform-service.mjs +0 -272
  508. package/resources/js3d/context/skills/platform-services/assets/modules/save.d.mts +0 -49
  509. package/resources/js3d/context/skills/platform-services/assets/modules/save.mjs +0 -1
  510. package/resources/js3d/context/skills/platform-services/assets/scaffold/ds/main.mjs +0 -7
  511. package/resources/js3d/context/skills/platform-services/assets/scaffold/ds/rooms/SyncRoom.mjs +0 -264
  512. package/resources/js3d/context/skills/platform-services/assets/scaffold/ds/rooms/syncSchema.mjs +0 -39
  513. package/resources/js3d/context/skills/platform-services/references/SERVER_GUIDE.md +0 -139
  514. package/resources/js3d/context/skills/platform-services/references/api_reference.md +0 -18
  515. package/resources/js3d/context/skills/platform-services/references/leaderboard_playbook.md +0 -96
  516. package/resources/js3d/context/skills/platform-services/scripts/install.mjs +0 -148
  517. package/resources/js3d/context/skills/resolution-adaptation/SKILL.md +0 -46
  518. package/resources/js3d/context/skills/resolution-adaptation/assets/display/ui-stage.ts +0 -156
  519. package/resources/js3d/context/skills/resolution-adaptation/assets/display/viewport.ts +0 -239
  520. package/resources/js3d/context/skills/resolution-adaptation/assets/example/main.ts +0 -129
  521. package/resources/js3d/context/skills/resolution-adaptation/assets/example/ui-tokens.css +0 -188
  522. package/resources/js3d/context/skills/resolution-adaptation/references/audit.md +0 -31
  523. package/resources/js3d/context/skills/resolution-adaptation/references/device-safe-area.md +0 -40
  524. package/resources/js3d/context/skills/resolution-adaptation/references/game-ui-occlusion.md +0 -18
  525. package/resources/js3d/context/skills/resolution-adaptation/references/layout-rules.md +0 -15
  526. package/resources/js3d/context/skills/resolution-adaptation/references/troubleshooting.md +0 -34
  527. package/resources/js3d/context/skills/resolution-adaptation/references/viewport-api.md +0 -38
  528. package/resources/js3d/context/skills/resolution-adaptation/scripts/aspect_audit.mjs +0 -448
  529. package/resources/js3d/context/skills/scene-editor-compat/SKILL.md +0 -599
  530. package/resources/js3d/context/skills/scene-editor-compat/references/bundle-contract.md +0 -141
  531. package/resources/js3d/context/skills/scene-editor-compat/references/editor-integration.md +0 -92
  532. package/resources/js3d/context/skills/scene-editor-compat/references/scene-data-format.md +0 -125
  533. package/resources/js3d/context/skills/scene-editor-compat/references/slots-rules.md +0 -113
  534. package/resources/js3d/context/skills/scene-editor-compat/scripts/scene-editor.mjs +0 -1187
  535. package/resources/js3d/context/skills/threejs-game-quality/SKILL.md +0 -53
  536. package/resources/js3d/context/skills/threejs-game-quality/agents/openai.yaml +0 -4
  537. package/resources/js3d/context/skills/threejs-game-quality/references/01-build.md +0 -94
  538. package/resources/js3d/context/skills/threejs-game-quality/references/02-avoid.md +0 -50
  539. package/resources/js3d/context/skills/threejs-game-quality/references/03-detect.md +0 -105
  540. package/resources/js3d/context/skills/threejs-game-quality/references/camera-by-genre.md +0 -147
  541. package/resources/js3d/context/skills/threejs-game-quality/references/camera-distance.md +0 -79
  542. package/resources/js3d/context/skills/threejs-game-quality/references/camera-sources.md +0 -56
  543. package/resources/js3d/context/skills/threejs-game-quality/references/character-motion-face.md +0 -51
  544. package/resources/js3d/context/skills/threejs-game-quality/references/parameter-contract.md +0 -55
  545. package/resources/js3d/context/skills/threejs-game-quality/references/refine-existing.md +0 -78
  546. package/resources/js3d/context/skills/threejs-game-quality/references/rendering-stability.md +0 -84
  547. package/resources/js3d/context/skills/threejs-game-quality/references/runtime-tools.md +0 -120
  548. package/resources/js3d/context/skills/threejs-game-quality/scripts/package.json +0 -4
  549. package/resources/js3d/context/skills/threejs-game-quality/scripts/runtime-audit.js +0 -238
  550. package/resources/js3d/context/skills/ui-editor-compat/SKILL.md +0 -59
  551. package/resources/js3d/context/skills/ui-editor-compat/assets/example/hud/WidgetLayout_Hud.ts +0 -35
  552. package/resources/js3d/context/skills/ui-editor-compat/assets/example/hud/WidgetLogic_Hud.ts +0 -61
  553. package/resources/js3d/context/skills/ui-editor-compat/assets/example/hud/hud.css +0 -60
  554. package/resources/js3d/context/skills/ui-editor-compat/assets/runtime/dom-ui.d.mts +0 -45
  555. package/resources/js3d/context/skills/ui-editor-compat/assets/runtime/dom-ui.mjs +0 -265
  556. package/resources/js3d/context/skills/ui-editor-compat/assets/runtime/release.json +0 -7
  557. package/resources/js3d/context/skills/ui-editor-compat/references/contract.md +0 -110
  558. package/resources/js3d/context/skills/ui-editor-compat/scripts/editor-contract.mjs +0 -327
  559. package/resources/js3d/context/skills/ui-editor-compat/scripts/project-files.mjs +0 -80
  560. package/resources/js3d/context/skills/ui-editor-compat/scripts/ui-editor.mjs +0 -84
  561. package/resources/js3d/context/skills/version-update/SKILL.md +0 -191
  562. package/resources/js3d/context/skills/version-update/scripts/check_runtime_refs.mjs +0 -129
  563. package/resources/js3d/context/skills/version-update/scripts/feature_snapshot.mjs +0 -159
  564. package/resources/js3d/context/skills/version-update/scripts/update_feature_version.mjs +0 -157
  565. package/resources/js3d/context/skills/version-update/upgrade_diffs/.gitkeep +0 -0
  566. package/resources/js3d/context/version/version.json +0 -1
  567. package/resources/js3d/project/runtime/lightgame/1.0.0/platform/config.d.mts +0 -19
  568. package/resources/js3d/project/runtime/lightgame/1.0.0/platform/config.mjs +0 -1
  569. package/resources/js3d/project/runtime/lightgame/1.0.0/platform/leaderboard.d.mts +0 -39
  570. package/resources/js3d/project/runtime/lightgame/1.0.0/platform/leaderboard.mjs +0 -1
  571. package/resources/js3d/project/runtime/lightgame/1.0.0/platform/platform-capture-video.mjs +0 -227
  572. package/resources/js3d/project/runtime/lightgame/1.0.0/platform/platform-service.d.mts +0 -25
  573. package/resources/js3d/project/runtime/lightgame/1.0.0/platform/platform-service.mjs +0 -1
  574. package/resources/js3d/project/runtime/lightgame/1.0.0/platform/platform.d.mts +0 -79
  575. package/resources/js3d/project/runtime/lightgame/1.0.0/platform/platform.mjs +0 -30
  576. package/resources/js3d/project/runtime/lightgame/1.0.0/platform/save.d.mts +0 -49
  577. package/resources/js3d/project/runtime/lightgame/1.0.0/platform/save.mjs +0 -1
  578. package/resources/js3d/project/runtime/lightgame/1.0.0/release.json +0 -39
  579. package/resources/js3d/project/runtime/lightgame/1.0.0/tooling/cli.mjs +0 -2
  580. package/resources/js3d/project/runtime/lightgame/1.0.0/tooling/project.d.mts +0 -8
  581. package/resources/js3d/project/runtime/lightgame/1.0.0/tooling/project.mjs +0 -2
  582. package/resources/js3d/project/runtime/lightgame/1.0.0/tooling/vite.d.mts +0 -3
  583. package/resources/js3d/project/runtime/lightgame/1.0.0/tooling/vite.mjs +0 -7
  584. package/resources/js3d/project/runtime/lightgame/1.0.0/tools/assets.d.mts +0 -24
  585. package/resources/js3d/project/runtime/lightgame/1.0.0/tools/assets.mjs +0 -2
  586. package/resources/js3d/project/runtime/lightgame/1.0.0/tools/astc.d.mts +0 -10
  587. package/resources/js3d/project/runtime/lightgame/1.0.0/tools/astc.mjs +0 -1
  588. package/resources/js3d/project/runtime/lightgame/1.0.0/tools/audio.d.mts +0 -20
  589. package/resources/js3d/project/runtime/lightgame/1.0.0/tools/audio.mjs +0 -1
  590. package/resources/js3d/project/runtime/lightgame/1.0.0/tools/canvas.d.mts +0 -21
  591. package/resources/js3d/project/runtime/lightgame/1.0.0/tools/canvas.mjs +0 -1
  592. package/resources/js3d/project/runtime/lightgame/1.0.0/tools/glb.d.mts +0 -26
  593. package/resources/js3d/project/runtime/lightgame/1.0.0/tools/glb.mjs +0 -351
  594. package/resources/js3d/project/runtime/lightgame/1.0.0/tools/input.d.mts +0 -17
  595. package/resources/js3d/project/runtime/lightgame/1.0.0/tools/input.mjs +0 -1
  596. package/resources/js3d/project/runtime/lightgame/1.0.0/tools/three.d.mts +0 -40
  597. package/resources/js3d/project/runtime/lightgame/1.0.0/tools/three.mjs +0 -1
  598. package/resources/js3d/project/runtime/lightgame/1.0.0/tools/ui.d.mts +0 -10
  599. package/resources/js3d/project/runtime/lightgame/1.0.0/tools/ui.mjs +0 -1
  600. package/resources/js3d/project/runtime/lightgame/1.0.0/tools/video.d.mts +0 -8
  601. package/resources/js3d/project/runtime/lightgame/1.0.0/tools/video.mjs +0 -1
  602. package/resources/js3d/project/scripts/refresh-runtime.mjs +0 -50
  603. package/resources/js3d/project/vendor/core-manager-three/package.json +0 -12
  604. package/resources/js3d/project/vendor/core-manager-three/src/index.ts +0 -2
  605. package/resources/js3d/project/vendor/run.sh +0 -4
  606. package/resources/js3d/project/version/craft_feature_version.json +0 -42
  607. package/resources/js3d/project/version/project_feature_version.json +0 -11
  608. package/vendor/agent-cli/dist/src/artifacts/scene-asset-delivery.d.ts +0 -7
  609. package/vendor/agent-cli/dist/src/artifacts/scene-asset-delivery.d.ts.map +0 -1
  610. package/vendor/agent-cli/dist/src/artifacts/scene-asset-delivery.js +0 -145
  611. package/vendor/agent-cli/dist/src/artifacts/scene-asset-delivery.js.map +0 -1
  612. /package/resources/js/{context/skills/export-config/scripts → project/scripts/config-export}/assert-asset-wiring.mjs +0 -0
  613. /package/resources/js3d/{context/skills/export-config/scripts → project/scripts/config-export}/assert-asset-wiring.mjs +0 -0
  614. /package/resources/js3d/{context/skills/export-config/scripts → project/scripts/config-export}/sync-asset-controls.mjs +0 -0
package/README.md CHANGED
@@ -6,16 +6,31 @@ Craft MCP 是面向支持本地 stdio MCP 的 AI IDE 的游戏制作服务,例
6
6
 
7
7
  ## AI IDE 安装指引
8
8
 
9
+ ### Codex / WorkBuddy 自动安装(推荐)
10
+
11
+ 显式选择当前宿主;逗号分隔可同时安装两者。安装当前包的稳定运行时、核验 MCP、备份并合并配置,安装全局 craft-create Skill。
12
+
13
+ ```sh
14
+ npx --yes --registry=https://registry.npmjs.org/ @craft_eco/craft-mcp@0.1.26 install --ide codex,workbuddy
15
+ npx --yes --registry=https://registry.npmjs.org/ @craft_eco/craft-mcp@0.1.26 doctor --ide codex,workbuddy
16
+ ```
17
+
18
+ 可用 --workspace <绝对游戏父目录> 和 --platform <HTTPS origin> 指定目录与平台;未提供时保留现有配置,新安装默认 ~/CraftGames 和本包平台。升级时运行新版本 install,旧运行时保留以便回退。安装不创建游戏、不修改信任权限。
19
+
20
+ Codex 配置 ~/.codex/config.toml(设置 CODEX_HOME 时使用其 config.toml),全局 Skill ~/.agents/skills/craft-create;WorkBuddy 配置 ~/.workbuddy/mcp.json,全局 Skill ~/.workbuddy/skills/craft-create。安装后在对应宿主开启新会话,必要时重启或重连 MCP。doctor 只核验文件与协议,不代表宿主已发现 Skill。
21
+
22
+ ### 手动接入与其他宿主
23
+
9
24
  以下命令只打印本页后退出;如果正在读取 guide 的输出,直接继续配置步骤:
10
25
 
11
26
  ```sh
12
- npx --yes --prefer-online --registry=https://registry.npmjs.org/ @craft_eco/craft-mcp@0.1.22 guide
27
+ npx --yes --prefer-online --registry=https://registry.npmjs.org/ @craft_eco/craft-mcp@0.1.26 guide
13
28
  ```
14
29
 
15
30
  1. 识别当前 AI IDE 的 MCP 设置入口和配置格式,按下方示例添加 Craft 服务,保留其他服务。只有需要相同环境的 Craft 服务才复用现有配置。
16
31
  2. 若无权修改宿主配置,展示匹配该宿主的配置让用户添加。不要把 JSON 写入 TOML,也不要覆盖用户整个配置文件。
17
32
  3. 在 AI IDE 中启用并重连 MCP 服务。普通终端执行启动命令不代表宿主已加载工具;服务参数不添加 guide。
18
- 4. 调用 craft_game_info,核对版本 0.1.22 和平台 https://test.craft.qq.com,再介绍实际可用功能。制作游戏前完整读取 context.engine.entrypoint 返回的 AGENTS.md 及其按需引用。
33
+ 4. 调用 craft_game_info,核对版本 0.1.26 和平台 https://test.craft.qq.com,再介绍实际可用功能。制作游戏前完整读取 context.engine.entrypoint 返回的 AGENTS.md 及其按需引用。
19
34
  5. 需要登录时调用 craft_auth_open,让用户只在返回的本机页面填写 CLI Key;凭据不进入聊天、游戏工程或共享配置。
20
35
 
21
36
  ### Codex:TOML 配置
@@ -25,14 +40,15 @@ npx --yes --prefer-online --registry=https://registry.npmjs.org/ @craft_eco/craf
25
40
  ```toml
26
41
  [mcp_servers.craft]
27
42
  command = "npx"
28
- args = ["--yes","--prefer-online","--registry=https://registry.npmjs.org/","@craft_eco/craft-mcp@0.1.22"]
43
+ args = ["--yes","--prefer-online","--registry=https://registry.npmjs.org/","@craft_eco/craft-mcp@0.1.26"]
29
44
  startup_timeout_sec = 120
30
45
 
31
46
  [mcp_servers.craft.env]
32
47
  CRAFT_WEB_URL = "https://test.craft.qq.com"
48
+ CRAFT_CLIENT_IDE = "codex"
33
49
  ```
34
50
 
35
- ### Trae、WorkBuddy 与支持 mcpServers JSON 的宿主
51
+ ### WorkBuddy 与支持 mcpServers JSON 的宿主
36
52
 
37
53
  在当前 AI IDE 的 MCP 管理页面添加本地 stdio 服务。Trae 官方说明:https://docs.trae.cn/ide_add-mcp-servers 。其他宿主按自身格式填写相同 command、args、env;宿主专属扩展字段不跨 IDE 复制。
38
54
 
@@ -45,19 +61,24 @@ CRAFT_WEB_URL = "https://test.craft.qq.com"
45
61
  "--yes",
46
62
  "--prefer-online",
47
63
  "--registry=https://registry.npmjs.org/",
48
- "@craft_eco/craft-mcp@0.1.22"
64
+ "@craft_eco/craft-mcp@0.1.26"
49
65
  ],
50
66
  "env": {
51
- "CRAFT_WEB_URL": "https://test.craft.qq.com"
67
+ "CRAFT_WEB_URL": "https://test.craft.qq.com",
68
+ "CRAFT_CLIENT_IDE": "workbuddy"
52
69
  }
53
70
  }
54
71
  }
55
72
  }
56
73
  ```
57
74
 
75
+ 其他宿主省略 CRAFT_CLIENT_IDE,得到通用 AGENTS.md 恢复入口。手动配置 MCP 不会安装全局 Skill;Codex/WorkBuddy 建议使用上方 install。
76
+
58
77
  ## 连接后的使用
59
78
 
60
- 默认游戏根目录为用户目录下的 CraftGames;继续已有工程时,在宿主环境变量配置中将 CLIENT_WORKSPACE_ROOT 设为原有绝对目录。
79
+ 默认游戏父目录为用户目录下的 CraftGames,游戏实际位于 <workspace>/<name>,不会自动跟随宿主当前目录。可在 MCP 环境配置中将 CLIENT_WORKSPACE_ROOT 设为游戏父目录,或在 npx 包名后追加 --workspace <绝对父目录>;重连后核对 craft_game_info.workspace。准备完成后在宿主打开返回的 project 目录。
80
+
81
+ 工程 prepare 自动维护根 AGENTS.md 的 Craft 恢复段;Codex 写 .agents/skills/craft-project/SKILL.md,WorkBuddy 写 .codebuddy/skills/craft-project/SKILL.md,未指定宿主只写 AGENTS.md。保留用户正文和同名用户 Skill。切换宿主时重新 prepare 接管既有工程,保留已有源码和另一宿主入口。引擎领域知识留在共享 MCP 资源中,通过工具返回的路径按需读取。
61
82
 
62
83
  素材按所选引擎原始契约引用:AIGC 使用平台返回的原始 URL,素材库使用候选原始 Path;不下载到 public、不改写模型依赖、不生成本地序列帧清单。以工具返回的 config_file 和 slot 定位配置,并由原始引擎解析器与 CDN 配置加载。
63
84
 
package/bin/craft-mcp.mjs CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { readFile } from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
3
5
 
4
6
  const [major, minor] = process.versions.node.split('.').map(Number);
5
7
  if (major < 22 || (major === 22 && minor < 12)) {
@@ -8,12 +10,18 @@ if (major < 22 || (major === 22 && minor < 12)) {
8
10
  }
9
11
 
10
12
  const args = process.argv.slice(2);
11
- if (args.length === 0) {
13
+ if (args.length === 0 || (args.length === 2 && args[0] === '--workspace' && path.isAbsolute(args[1]))) {
14
+ if (args.length) process.env.CLIENT_WORKSPACE_ROOT = path.resolve(args[1]);
12
15
  await import('../dist-server/mcp/start.mjs');
13
16
  } else if (args.length === 1 && args[0] === 'guide') {
14
17
  process.stdout.write(await readFile(new URL('../README.md', import.meta.url), 'utf8'));
18
+ } else if (['install', 'doctor'].includes(args[0])) {
19
+ try {
20
+ const { runIntegrationCommand } = await import('../dist-server/integrations/install.mjs');
21
+ await runIntegrationCommand(args, fileURLToPath(new URL('..', import.meta.url)));
22
+ } catch (error) { process.stderr.write('Craft ' + args[0] + ' failed: ' + error.message + '\n'); process.exitCode = 1; }
15
23
  } else if (args.length === 1 && ['--help', '-h', 'help'].includes(args[0])) {
16
- process.stdout.write('Usage: craft-mcp [guide|--help]\n\nNo arguments: start the stdio MCP server.\nguide: print AI IDE installation instructions and exit.\n');
24
+ process.stdout.write('Usage: craft-mcp [--workspace <absolute games directory>|guide|--help]\n craft-mcp install --ide codex,workbuddy [--workspace <absolute games directory>] [--platform <HTTPS origin>]\n craft-mcp doctor --ide codex,workbuddy\n\nNo arguments: start the stdio MCP server.\n--workspace: override CLIENT_WORKSPACE_ROOT; games are created under <workspace>/<name>.\nDefault workspace: ~/CraftGames. The host current directory is not used.\nguide: print AI IDE installation instructions and exit.\ninstall: install this package into a stable runtime, verify MCP, merge the selected host configurations and install craft-create Skills. Existing workspace/platform are preserved unless specified.\ndoctor: verify configured MCP and bootstrap Skill files; host discovery still requires a new host session.\n');
17
25
  } else {
18
26
  process.stderr.write('Unknown command or extra arguments. Use craft-mcp --help.\n');
19
27
  process.exitCode = 1;
@@ -0,0 +1,43 @@
1
+ import path from 'node:path';
2
+ import { lstat, readdir, readFile } from 'node:fs/promises';
3
+ import { createHash } from 'node:crypto';
4
+
5
+ export const bundleContracts = Object.freeze({ export:1, skills:1, mcp:1, sdk_lifecycle:1 });
6
+ export const digest = value => createHash('sha256').update(value).digest('hex');
7
+ export function bundleId(manifest) {
8
+ const { id, ...body } = manifest;
9
+ return digest(JSON.stringify(body));
10
+ }
11
+
12
+ // Hash the complete engine payload, including executable skills, hooks and template.
13
+ // Common workflow and the selected engine guide travel with each version as well.
14
+ export async function bundleFiles(root, engine) {
15
+ if (!['js','js3d'].includes(engine)) throw new Error('Unsupported bundle engine');
16
+ const files = {};
17
+ async function visit(relative) {
18
+ const file = path.join(root,relative), stat = await lstat(file);
19
+ if (stat.isSymbolicLink()) throw new Error('Context bundle contains a link: ' + relative);
20
+ if (stat.isDirectory()) {
21
+ for (const name of (await readdir(file)).sort()) await visit(relative + '/' + name);
22
+ } else if (stat.isFile()) files[relative] = digest(await readFile(file));
23
+ else throw new Error('Invalid context bundle file: ' + relative);
24
+ }
25
+ if ((await lstat(root)).isSymbolicLink() || (await lstat(path.join(root,engine))).isSymbolicLink() ||
26
+ (await lstat(path.join(root,'craft-game-maker'))).isSymbolicLink()) throw new Error('Context bundle root contains a link');
27
+ for (const relative of [engine+'/context',engine+'/project','craft-game-maker/SKILL.md','craft-game-maker/'+engine+'.md']) await visit(relative);
28
+ return files;
29
+ }
30
+
31
+ export async function verifyBundle(root, engine, expectedId) {
32
+ const file = path.join(root,engine,'bundle.json');
33
+ if (!(await lstat(file)).isFile() || (await lstat(file)).isSymbolicLink()) throw new Error('Invalid bundle manifest');
34
+ const manifest = JSON.parse(await readFile(file,'utf8'));
35
+ if (manifest.schema !== 1 || manifest.engine !== engine || manifest.id !== bundleId(manifest) ||
36
+ (expectedId && manifest.id !== expectedId)) throw new Error('Context bundle identity mismatch: ' + engine);
37
+ for (const [key,version] of Object.entries(bundleContracts)) {
38
+ if (manifest.contracts?.[key] !== version) throw new Error('Incompatible context contract: ' + key + '; install a Craft version supporting this bundle');
39
+ }
40
+ const actual = await bundleFiles(root,engine);
41
+ if (JSON.stringify(actual) !== JSON.stringify(manifest.files)) throw new Error('Context bundle integrity check failed: ' + engine);
42
+ return manifest;
43
+ }
@@ -1,12 +1,13 @@
1
1
  import path from 'node:path';
2
2
  import { readFile } from 'node:fs/promises';
3
+ import { verifyBundle } from './bundle-files.mjs';
3
4
 
4
5
  // Keep project validation and resource selection on the same engine definitions.
5
6
  const definitions = {
6
7
  js: { label:'2D / Phaser', dependency:'phaser', files:['configs/assets.json','src/scenes/LoadScene.ts','src/scenes/PlayScene.ts'],
7
8
  references:{loading:'knowledge/Lifecycle.md'} },
8
9
  js3d: { label:'3D / Three.js', dependency:'three', files:[],
9
- references:{runtime:'knowledge/Runtime.md',pitfalls:'knowledge/CodingGuide/Pitfalls.md',scene_editor:'knowledge/SceneEditorCompat.md'} },
10
+ references:{runtime:'knowledge/Runtime.md',pitfalls:'knowledge/CodingGuide/Pitfalls.md'} },
10
11
  };
11
12
 
12
13
  export function engineDefinition(engine) {
@@ -18,13 +19,19 @@ export async function loadEngineResources(resources) {
18
19
  const workflow = path.join(resources,'craft-game-maker','SKILL.md');
19
20
  const instructions = await readFile(workflow,'utf8');
20
21
  const engines = {};
21
- for (const [engine,definition] of Object.entries(definitions)) {
22
+ for (const engine of Object.keys(definitions)) engines[engine] = await loadEngineResource(resources,engine);
23
+ return { instructions, engines };
24
+ }
25
+
26
+ export async function loadEngineResource(resources, engine, expectedId) {
27
+ const definition = engineDefinition(engine), bundle = await verifyBundle(resources,engine,expectedId);
28
+ const workflow = path.join(resources,'craft-game-maker','SKILL.md');
29
+ const instructions = await readFile(workflow,'utf8');
22
30
  const directory = path.join(resources,engine,'context');
23
31
  const guide = path.join(resources,'craft-game-maker',engine + '.md');
24
- engines[engine] = { engine, label:definition.label, template:path.join(resources,engine,'project'),
32
+ return { engine, label:definition.label, resources, bundle, template:path.join(resources,engine,'project'),
25
33
  instructions:instructions + '\n\n' + await readFile(guide,'utf8'),
26
- context:{ workflow, engine:{name:engine,directory,guide,entrypoint:path.join(directory,'AGENTS.md')},
34
+ context:{ workflow, bundle:{id:bundle.id,source_revision:bundle.source_revision,contracts:bundle.contracts,compatibility:bundle.compatibility},
35
+ engine:{name:engine,directory,guide,entrypoint:path.join(directory,'AGENTS.md'),skills_index:path.join(directory,'skills/index.json')},
27
36
  references:Object.fromEntries(Object.entries(definition.references).map(([key,file])=>[key,path.join(directory,file)])) } };
28
- }
29
- return { instructions, engines };
30
37
  }
@@ -0,0 +1,90 @@
1
+ import path from 'node:path';
2
+ import { cp, mkdir, mkdtemp, readFile, writeFile, lstat, rename, rm } from 'node:fs/promises';
3
+ import { safeProjectFile } from './asset-import.mjs';
4
+ import { loadEngineResource } from './engines.mjs';
5
+ import { verifyBundle } from './bundle-files.mjs';
6
+
7
+ export const contextLock = '.craft/context-lock.json';
8
+ export async function readContextLock(project, engine) {
9
+ let lock;
10
+ try { lock = JSON.parse(await readFile(await safeProjectFile(project,contextLock),'utf8')); }
11
+ catch (error) { if (error.code === 'ENOENT') return null; throw error; }
12
+ if (lock.schema !== 1 || lock.engine !== engine || !/^[a-f0-9]{64}$/.test(lock.bundle_id) ||
13
+ typeof lock.source_revision !== 'string') throw new Error('Invalid project context lock or engine mismatch; restore the project lock from version control');
14
+ return lock;
15
+ }
16
+
17
+ export async function checkProjectCompatibility(project, bundle) {
18
+ const runtime = JSON.parse(await readFile(await safeProjectFile(project,'game-runtime.json'),'utf8'));
19
+ const pkg = JSON.parse(await readFile(await safeProjectFile(project,'package.json'),'utf8'));
20
+ const c = bundle.compatibility;
21
+ // Exact versions are the tested contract. Widen only with engine-specific validation.
22
+ if (runtime.version !== c.runtime_version || pkg.dependencies?.[c.dependency] !== c.dependency_version) {
23
+ throw new Error('Incompatible project runtime/dependency for '+bundle.engine+' context '+bundle.id+
24
+ '; expected runtime '+c.runtime_version+' and '+c.dependency+' '+c.dependency_version+'. Restore matching project versions or explicitly migrate and validate the engine bundle');
25
+ }
26
+ }
27
+
28
+ async function regularDirectory(directory) {
29
+ await mkdir(directory,{recursive:true});
30
+ const stat = await lstat(directory);
31
+ if (!stat.isDirectory() || stat.isSymbolicLink()) throw new Error('Context cache must not contain directory links');
32
+ }
33
+
34
+ export class ProjectBundles {
35
+ constructor(state, engines) { this.cache = path.join(state,'context-bundles'); this.engines = engines; }
36
+ async retain(selected) {
37
+ await regularDirectory(this.cache);
38
+ const {engine,bundle,resources} = selected, target = path.join(this.cache,bundle.id);
39
+ try { await lstat(target); await verifyBundle(target,engine,bundle.id); return; }
40
+ catch (error) { if (error.code !== 'ENOENT') throw error; }
41
+ const staging = await mkdtemp(path.join(this.cache,'.staging-'));
42
+ try {
43
+ for (const name of [...Object.keys(bundle.files),engine+'/bundle.json']) {
44
+ await mkdir(path.dirname(path.join(staging,name)),{recursive:true});
45
+ await cp(path.join(resources,name),path.join(staging,name),{dereference:false});
46
+ }
47
+ await verifyBundle(staging,engine,bundle.id);
48
+ try { await rename(staging,target); }
49
+ catch (error) {
50
+ if (!['EEXIST','ENOTEMPTY','EPERM'].includes(error.code)) throw error;
51
+ await verifyBundle(target,engine,bundle.id);
52
+ }
53
+ } finally { await rm(staging,{recursive:true,force:true}); }
54
+ }
55
+ async resolve(project, engine, lock) {
56
+ if (!lock) throw new Error('Project context is unbound; run craft_game_prepare to validate and bind the existing game without resetting its source');
57
+ const current = this.engines[engine];
58
+ if (current.bundle.id !== lock.bundle_id && (await lstat(this.cache).catch(error=>{
59
+ if (error.code === 'ENOENT') return null;
60
+ throw error;
61
+ }))?.isSymbolicLink()) throw new Error('Context cache must not contain directory links');
62
+ const resources = current.bundle.id === lock.bundle_id ? current.resources : path.join(this.cache,lock.bundle_id);
63
+ let selected;
64
+ try { selected = await loadEngineResource(resources,engine,lock.bundle_id); }
65
+ catch (error) {
66
+ if (error.code === 'ENOENT') throw new Error('Missing pinned context bundle '+lock.bundle_id+' ('+engine+', source '+lock.source_revision+'). Restore the matching Craft distribution or its context-bundles cache; the project has not been upgraded');
67
+ throw error;
68
+ }
69
+ if (selected.bundle.source_revision !== lock.source_revision) throw new Error('Project context source revision mismatch');
70
+ await checkProjectCompatibility(project,selected.bundle);
71
+ return selected;
72
+ }
73
+ async bind(project, engine) {
74
+ const existing = await readContextLock(project,engine);
75
+ const selected = existing ? await this.resolve(project,engine,existing) : await loadEngineResource(this.engines[engine].resources,engine);
76
+ await checkProjectCompatibility(project,selected.bundle);
77
+ await this.retain(selected);
78
+ if (existing) return existing;
79
+ const lock = {schema:1,engine,bundle_id:selected.bundle.id,source_revision:selected.bundle.source_revision};
80
+ const file = await safeProjectFile(project,contextLock,true);
81
+ try { await writeFile(file,JSON.stringify(lock,null,2)+'\n',{flag:'wx'}); }
82
+ catch (error) {
83
+ if (error.code !== 'EEXIST') throw error;
84
+ const concurrent = await readContextLock(project,engine);
85
+ await this.resolve(project,engine,concurrent);
86
+ return concurrent;
87
+ }
88
+ return lock;
89
+ }
90
+ }
@@ -0,0 +1,91 @@
1
+ import path from 'node:path';
2
+ import { readFile, writeFile, rename, lstat } from 'node:fs/promises';
3
+ import { createHash } from 'node:crypto';
4
+ import { safeProjectFile } from './asset-import.mjs';
5
+ import { clientIde, projectSkillPath } from '../integrations/hosts.mjs';
6
+
7
+ const start = '<!-- craft-mcp:project:start -->';
8
+ const end = '<!-- craft-mcp:project:end -->';
9
+
10
+ export function projectContextPaths(project, ide = 'generic') {
11
+ const host = clientIde(ide), relative = projectSkillPath(host);
12
+ const skill = relative ? path.join(project, relative) : null;
13
+ return { entrypoint: path.join(project, 'AGENTS.md'), progress: path.join(project, 'SPEC/PROGRESS.md'), host, skill,
14
+ ...(host === 'workbuddy' ? { workbuddy_skill: skill } : {}) };
15
+ }
16
+
17
+ function recovery(name, engine) {
18
+ return `Craft 工程名:\`${name}\`;引擎:\`${engine}\`。保持已有引擎与用户源码。\n\n`
19
+ + '先读 `SPEC/PROGRESS.md` 和已有的 SPEC 设计文件,核对已完成玩法、待办及最近验收;缺少记录时检查源码与工具回执,不根据旧聊天猜测。\n\n'
20
+ + `继续本工程前调用 \`craft_game_info({"name":"${name}"})\`,核对返回的 project 是当前目录、context_binding.status 为 bound。读取返回的 \`context.workflow\`、\`context.engine.entrypoint\` 和 \`context.engine.skills_index\`;按索引 description 选择技能,相对于 context.engine.directory 读取 entrypoint,再按需读取引用。\n\n`
21
+ + `MCP 的 workspace 是游戏父目录,工程位于 \`workspace/${name}\`,不自动跟随宿主当前目录。若不匹配,先在宿主 MCP 设置中将 \`--workspace\` 参数(优先)或 \`CLIENT_WORKSPACE_ROOT\` 指向当前游戏的父目录并重连;不要在错误目录创建同名工程。\n\n`
22
+ + `迁移目录或首次恢复时若提示尚未 prepare,确认 workspace 后调用 \`craft_game_prepare({"name":"${name}","engine":"${engine}"})\` 并轮询任务完成;已有合法工程只会被接管,不重置模板。目录更名后使用当前目录名(须符合工具的英文 name 规则)。\n\n`
23
+ + '项目以 `.craft/context-lock.json` 绑定引擎上下文版本,随项目保存;实际路径每次通过工具查询。缺少绑定时由 prepare 核验后建立,缺包或不兼容时按诊断恢复匹配版本,不删除锁文件来绕过检查。上下文、模板和技能脚本由 Craft 版本包提供,不复制到游戏中;MCP 未连接时先连接项目使用的 Craft 服务。\n\n'
24
+ + '验收使用 `craft_game_check` → `craft_game_review` → `craft_game_deliver`;宿主按返回命令启动预览,再核对当前快照已运行。构建成功不代表预览自动开启。\n\n'
25
+ + '完成开发或停在中间状态时更新 `SPEC/PROGRESS.md`:当前玩法和操作、已完成/待办、关键文件、最近验收任务及结果、预览状态和下一步。记录可核实的事实,验收失败也保留;预览地址须重新查询,只读任务不写进度。';
26
+ }
27
+
28
+ // Only our marked section is managed. User text before/after it remains byte-for-byte intact.
29
+ function mergeEntry(original, block) {
30
+ const begins = original.split(start).length - 1, ends = original.split(end).length - 1;
31
+ if (!begins && !ends) return original + (original && !original.endsWith('\n') ? '\n' : '') + (original ? '\n' : '') + block + '\n';
32
+ if (begins !== 1 || ends !== 1 || original.indexOf(end) < original.indexOf(start)) throw new Error('Ambiguous Craft managed section in AGENTS.md; preserve and repair its markers before preparing');
33
+ return original.slice(0, original.indexOf(start)) + block + original.slice(original.indexOf(end) + end.length);
34
+ }
35
+
36
+ async function readOptional(file) {
37
+ try { return await readFile(file, 'utf8'); }
38
+ catch (error) { if (error.code !== 'ENOENT') throw error; return ''; }
39
+ }
40
+
41
+ function ownedSkill(content) {
42
+ return content.startsWith('---\nname: craft-project\n') && content.includes(start) && content.endsWith(end + '\n');
43
+ }
44
+
45
+ // Retire only Craft's old discovery file, keeping its contents and all neighbouring user files.
46
+ async function migrateWorkBuddySkill(project, canonicalStatus) {
47
+ const relative = '.workbuddy/skills/craft-project/SKILL.md';
48
+ let legacy;
49
+ try { legacy = await safeProjectFile(project, relative); }
50
+ catch (error) { if (error.code === 'ENOENT') return { status: 'not_present' }; throw error; }
51
+ const content = await readOptional(legacy);
52
+ if (!content) return { status: 'not_present' };
53
+ if (!ownedSkill(content)) return { status: 'preserved_user_file', path: legacy };
54
+ if (canonicalStatus !== 'managed') return { status: 'preserved_conflict', path: legacy };
55
+ const suffix = '.craft-backup-' + createHash('sha256').update(content).digest('hex').slice(0, 16);
56
+ const backup = await safeProjectFile(project, relative + suffix);
57
+ try { await lstat(backup); throw new Error('Legacy Craft Skill backup already exists; preserve both files and resolve before preparing'); }
58
+ catch (error) { if (error.code !== 'ENOENT') throw error; }
59
+ if (await readFile(legacy, 'utf8') !== content) throw new Error('Legacy Craft Skill changed while preparing');
60
+ await rename(legacy, backup);
61
+ return { status: 'migrated', from: legacy, backup };
62
+ }
63
+
64
+ export async function prepareProjectContext(project, name, engine, ide = 'generic') {
65
+ const paths = projectContextPaths(project, ide);
66
+ const entry = await safeProjectFile(project, 'AGENTS.md');
67
+ const original = await readOptional(entry);
68
+ const body = recovery(name, engine);
69
+ const updated = mergeEntry(original, start + '\n## Craft 项目恢复\n\n' + body + '\n' + end);
70
+ const skill = paths.skill ? await safeProjectFile(project, projectSkillPath(paths.host), true) : null;
71
+ const existingSkill = skill ? await readOptional(skill) : '';
72
+ const label = engine === 'js3d' ? '3D / Three.js' : '2D / Phaser';
73
+ const desiredSkill = `---\nname: craft-project\ndescription: 继续、修改、调试、验收或预览当前 Craft ${label} 游戏 ${name};新会话恢复项目进度、引擎上下文和预览状态时使用。Continue this existing Craft game; use craft-create only for a new game.\n---\n\n`
74
+ + start + '\n# 继续当前 Craft 游戏\n\n'
75
+ + `1. 读取项目根 \`AGENTS.md\`,确认工程 \`${name}\` 和引擎 \`${engine}\`。\n`
76
+ + '2. 按项目恢复规则读取 `SPEC/PROGRESS.md`、已有设计记录并调用 `craft_game_info`。核对工程路径、引擎与版本绑定后,读取返回的工作流、引擎入口和技能索引,按任务描述选择技能。\n'
77
+ + '3. 根据实际进度继续工作;仅恢复上下文时无需重新 prepare 或重建模板。完成修改后更新进度并按工作流验收、看图、启动预览。\n'
78
+ + end + '\n';
79
+ // A same-name user skill is not ours to replace. AGENTS.md remains the recovery entry.
80
+ const skillStatus = !skill ? 'not_requested' : existingSkill && !ownedSkill(existingSkill) ? 'preserved_user_file' : 'managed';
81
+ const progress = await safeProjectFile(project, 'SPEC/PROGRESS.md', true);
82
+ // This is project-owned state, never regenerated by prepare or a runtime upgrade.
83
+ try { await writeFile(progress, `# Craft 项目进度\n\n- 工程:\`${name}\`\n- 引擎:\`${engine}\`(${label})\n- 上下文入口:\`AGENTS.md\`\n\n## 当前状态\n\n已建立项目恢复入口。玩法、开发进度及验收结果尚待核对,请依据现有源码与工具回执补充。\n\n## 后续工作\n\n读取已有 SPEC 设计文件和源码,按用户需求继续开发;记录已完成事项、待办、操作方式、关键文件和验收任务。\n`, { flag: 'wx' }); }
84
+ catch (error) { if (error.code !== 'EEXIST') throw error; }
85
+ if (updated !== original) await writeFile(entry, updated);
86
+ if (skillStatus === 'managed' && existingSkill !== desiredSkill) await writeFile(skill, desiredSkill);
87
+ const migration = paths.host === 'workbuddy' ? await migrateWorkBuddySkill(project, skillStatus) : null;
88
+ return { ...paths, skill_status: skillStatus,
89
+ ...(migration ? { legacy_skill: migration } : {}),
90
+ ...(paths.host === 'workbuddy' ? { workbuddy_skill_status: skillStatus } : {}) };
91
+ }
@@ -5,6 +5,9 @@ import { seedProjectTemplate } from '#craft-sdk';
5
5
  import { atomicJson } from './request-store.mjs';
6
6
  import { assetConfig, safeProjectFile } from './asset-import.mjs';
7
7
  import { engineDefinition } from './engines.mjs';
8
+ import { prepareProjectContext } from './project-context.mjs';
9
+ import { clientIde } from '../integrations/hosts.mjs';
10
+ import { ProjectBundles, readContextLock } from './project-bundles.mjs';
8
11
 
9
12
  async function inspectProject(project, expected) {
10
13
  const runtime = JSON.parse(await readFile(await safeProjectFile(project,'game-runtime.json'),'utf8'));
@@ -27,7 +30,7 @@ async function readRecord(file, project) {
27
30
  }
28
31
 
29
32
  export class Projects {
30
- constructor(root, state, engines) { this.root = root; this.state = path.join(state,'projects'); this.engines = engines; }
33
+ constructor(root, state, engines, ide = 'generic') { this.root = root; this.state = path.join(state,'projects'); this.engines = engines; this.ide = clientIde(ide); this.bundles = new ProjectBundles(state,engines); }
31
34
  async init() { await mkdir(this.state, { recursive: true }); }
32
35
  file(name) {
33
36
  if (typeof name !== 'string' || !/^[a-z][a-z0-9-]{0,47}$/.test(name)) throw new Error('Project name must match [a-z][a-z0-9-]{0,47}');
@@ -36,13 +39,18 @@ export class Projects {
36
39
  async owned(name) {
37
40
  return (await this.describe(name)).project;
38
41
  }
39
- async describe(name) {
42
+ async describe(name, {allowUnbound = false} = {}) {
40
43
  const project = this.file(name);
41
44
  if ((await lstat(project)).isSymbolicLink() || await realpath(project) !== project) throw new Error('Project path changed or is a symbolic link');
42
45
  const record = await readRecord(path.join(this.state,name + '.json'),project);
43
46
  if (!record) throw new Error('Prepare this project before using it');
44
47
  const engine = await inspectProject(project,record.engine);
45
- return { name, project, engine };
48
+ const lock = await readContextLock(project,engine);
49
+ if (lock || !allowUnbound) await this.bundles.resolve(project,engine,lock);
50
+ return { name, project, engine, context_binding:lock ? {status:'bound',...lock} : {status:'unbound',action:'Run craft_game_prepare to validate and bind this existing project; source files are preserved'} };
51
+ }
52
+ async resourcesFor(description) {
53
+ return this.bundles.resolve(description.project,description.engine,await readContextLock(description.project,description.engine));
46
54
  }
47
55
  async prepare(name, requestedEngine, signal) {
48
56
  signal?.throwIfAborted();
@@ -58,6 +66,7 @@ export class Projects {
58
66
  if (created) await seedProjectTemplate(this.engines[requestedEngine ?? record?.engine ?? 'js'].template,project,{ signal });
59
67
  // Existing Craft games are adopted, never overwritten or silently converted from another engine.
60
68
  const engine = await inspectProject(project,record?.engine ?? requestedEngine);
69
+ const lock = await this.bundles.bind(project,engine);
61
70
  signal?.throwIfAborted();
62
71
  if (engine === 'js3d') {
63
72
  const assets = await safeProjectFile(project,'configs/assets.json');
@@ -67,7 +76,8 @@ export class Projects {
67
76
  await assetConfig(project);
68
77
  signal?.throwIfAborted();
69
78
  if (!record?.engine) await atomicJson(recordFile,{ schema:1, name, project, engine });
70
- return { name, project, created, engine };
79
+ const project_context = await prepareProjectContext(project, name, engine, this.ide);
80
+ return { name, project, created, engine, project_context, context_binding:{status:'bound',...lock} };
71
81
  }
72
82
  }
73
83
 
@@ -82,6 +92,8 @@ export async function fingerprint(project) {
82
92
  if (entry.isSymbolicLink()) throw new Error('Source symbolic links are not supported: ' + key);
83
93
  if (entry.isDirectory()) { await walk(file,key); continue; }
84
94
  if (!entry.isFile()) throw new Error('Unsupported source file: ' + key);
95
+ // Session handoff notes are not build inputs. Recording a check receipt must not invalidate that check.
96
+ if (key === '/SPEC/PROGRESS.md' || /^\/\.workbuddy\/memory\/.*\.md$/.test(key)) continue;
85
97
  const stat = await lstat(file);
86
98
  if (++files > 10000 || (bytes += stat.size) > 128 * 1024 * 1024) throw new Error('Project exceeds source snapshot limits');
87
99
  hash.update(key).update('\0').update(await readFile(file)).update('\0');
@@ -0,0 +1,71 @@
1
+ import { parse, stringify } from 'smol-toml';
2
+ import { isDeepStrictEqual } from 'node:util';
3
+
4
+ export function readConfig(text, ide) {
5
+ const config = text.trim() ? (ide === 'codex' ? parse(text) : JSON.parse(text)) : {};
6
+ if (!config || typeof config !== 'object' || Array.isArray(config)) throw new Error('Expected an object config');
7
+ const servers = config[ide === 'codex' ? 'mcp_servers' : 'mcpServers'];
8
+ if (servers !== undefined && (!servers || typeof servers !== 'object' || Array.isArray(servers))) throw new Error('Invalid MCP server table');
9
+ return config;
10
+ }
11
+
12
+ export function craftConfig(text, ide) {
13
+ return readConfig(text, ide)[ide === 'codex' ? 'mcp_servers' : 'mcpServers']?.craft;
14
+ }
15
+
16
+ // Track strings and value arrays so apparent headers inside multiline values stay untouched.
17
+ function sections(text) {
18
+ const found = []; let offset = 0, quote = null, multiline = false, depth = 0;
19
+ for (const line of text.match(/[^\n]*\n|[^\n]+$/g) ?? []) {
20
+ if (!quote && depth === 0 && /^\s*\[/.test(line)) {
21
+ const header = parse(line), keys = []; let child = header;
22
+ while (child && typeof child === 'object' && !Array.isArray(child) && Object.keys(child).length === 1) {
23
+ const key = Object.keys(child)[0]; keys.push(key); child = child[key];
24
+ }
25
+ found.push({ start: offset, keys });
26
+ } else {
27
+ for (let i = 0; i < line.length; i++) {
28
+ const c = line[i];
29
+ if (quote) {
30
+ if (quote === '"' && c === '\\') { i++; continue; }
31
+ if (c === quote) {
32
+ if (!multiline) quote = null;
33
+ else if (line.slice(i, i + 3) === quote.repeat(3)) {
34
+ while (line[i + 3] === quote) i++;
35
+ i += 2; quote = null; multiline = false;
36
+ }
37
+ }
38
+ } else if (c === '#') break;
39
+ else if (c === '"' || c === "'") { quote = c; multiline = line.slice(i, i + 3) === c.repeat(3); if (multiline) i += 2; }
40
+ else if (c === '[' || c === '{') depth++;
41
+ else if (c === ']' || c === '}') depth--;
42
+ }
43
+ }
44
+ offset += line.length;
45
+ }
46
+ return found.map((section, i) => ({ ...section, end: found[i + 1]?.start ?? text.length }));
47
+ }
48
+
49
+ export function mergeConfig(text, ide, connection) {
50
+ const before = readConfig(text, ide), table = ide === 'codex' ? 'mcp_servers' : 'mcpServers';
51
+ const previous = before[table]?.craft ?? {};
52
+ if (typeof previous !== 'object' || Array.isArray(previous)) throw new Error('Invalid craft server entry');
53
+ // Preserve host-specific options and user environment; replace only connection identity.
54
+ const next = { ...previous, ...connection, env: { ...previous.env, ...connection.env } };
55
+ for (const key of ['url', 'http_headers', 'env_http_headers', 'bearer_token_env_var']) delete next[key];
56
+ if (ide === 'codex') { delete next.disabled; next.enabled = true; }
57
+ else { delete next.enabled; next.disabled = false; }
58
+ const normalizedNext = ide === 'codex' ? parse(stringify({ value: next })).value : next;
59
+ if (isDeepStrictEqual(previous, normalizedNext)) return text;
60
+ const expected = { ...before, [table]: { ...before[table], craft: next } };
61
+ if (ide !== 'codex') return JSON.stringify(expected, null, 2) + '\n';
62
+ const owned = sections(text).filter(({ keys }) => keys[0] === 'mcp_servers' && keys[1] === 'craft');
63
+ if (before.mcp_servers?.craft && !owned.length) throw new Error('Inline/dotted craft TOML entry: move it to [mcp_servers.craft] before installing; config was preserved');
64
+ let kept = '', from = 0;
65
+ for (const section of owned) { kept += text.slice(from, section.start); from = section.end; }
66
+ kept += text.slice(from);
67
+ const output = kept + (kept.endsWith('\n') || !kept ? '' : '\n') + '\n' + stringify({ mcp_servers: { craft: next } });
68
+ // This also rejects unsupported inline parent tables without changing the user's file.
69
+ if (!isDeepStrictEqual(parse(output), parse(stringify(expected)))) throw new Error('TOML merge changed unrelated settings; config was preserved');
70
+ return output;
71
+ }
@@ -0,0 +1,54 @@
1
+ import path from 'node:path';
2
+ import { lstat, readFile, mkdir, writeFile, rename, unlink } from 'node:fs/promises';
3
+ import { randomUUID } from 'node:crypto';
4
+
5
+ export async function optionalFile(file) {
6
+ try { return await readFile(file, 'utf8'); }
7
+ catch (error) { if (error.code !== 'ENOENT') throw error; return null; }
8
+ }
9
+
10
+ export async function assertPlainPath(file) {
11
+ let current = path.resolve(file);
12
+ for (;;) {
13
+ try {
14
+ const info = await lstat(current);
15
+ if (info.isSymbolicLink() || (current === path.resolve(file) ? !info.isFile() : !info.isDirectory())) throw new Error('Refusing linked or invalid install path: ' + current);
16
+ } catch (error) { if (error.code !== 'ENOENT') throw error; }
17
+ const parent = path.dirname(current); if (parent === current) break; current = parent;
18
+ }
19
+ }
20
+
21
+ async function replace(file, text) {
22
+ await mkdir(path.dirname(file), { recursive: true });
23
+ const temporary = file + '.' + randomUUID() + '.tmp';
24
+ try { await writeFile(temporary, text, { mode: 0o600, flag: 'wx' }); await rename(temporary, file); }
25
+ finally { await unlink(temporary).catch(error => { if (error.code !== 'ENOENT') throw error; }); }
26
+ }
27
+
28
+ // Preflight all destinations, keep private backups, and roll back only our unchanged writes.
29
+ export async function commitFiles(changes) {
30
+ const pending = changes.filter(change => change.before !== change.after), committed = [], backups = [];
31
+ for (const change of pending) {
32
+ await assertPlainPath(change.file);
33
+ if (await optionalFile(change.file) !== change.before) throw new Error('File changed during installation: ' + change.file);
34
+ }
35
+ try {
36
+ for (const change of pending) {
37
+ await assertPlainPath(change.file);
38
+ if (await optionalFile(change.file) !== change.before) throw new Error('File changed during installation: ' + change.file);
39
+ if (change.before !== null) {
40
+ const backup = change.file + '.craft-backup-' + randomUUID();
41
+ await writeFile(backup, change.before, { flag: 'wx', mode: 0o600 }); backups.push(backup);
42
+ }
43
+ await replace(change.file, change.after); committed.push(change);
44
+ }
45
+ } catch (error) {
46
+ for (const change of committed.reverse()) {
47
+ if (await optionalFile(change.file) === change.after) {
48
+ if (change.before === null) await unlink(change.file); else await replace(change.file, change.before);
49
+ }
50
+ }
51
+ throw error;
52
+ }
53
+ return { changed: pending.map(change => change.file), backups };
54
+ }
@@ -0,0 +1,30 @@
1
+ import path from 'node:path';
2
+
3
+ export const hosts = Object.freeze({
4
+ codex: { config: '.codex/config.toml', skills: '.agents/skills', projectSkills: '.agents/skills', format: 'toml' },
5
+ workbuddy: { config: '.workbuddy/mcp.json', skills: '.workbuddy/skills', projectSkills: '.codebuddy/skills', format: 'json' },
6
+ });
7
+
8
+ export function clientIde(value) {
9
+ if (value === undefined || value === '' || value === 'generic') return 'generic';
10
+ if (!Object.hasOwn(hosts, value)) throw new Error('Unsupported Craft IDE: ' + value);
11
+ return value;
12
+ }
13
+
14
+ export function installTargets(value) {
15
+ const targets = value?.split(',');
16
+ if (!targets?.length || targets.some(ide => !Object.hasOwn(hosts, ide))) throw new Error('--ide must explicitly select codex, workbuddy, or codex,workbuddy');
17
+ return [...new Set(targets)];
18
+ }
19
+
20
+ export function hostPaths(home, ide, codexHome) {
21
+ const host = hosts[clientIde(ide)];
22
+ if (!host) throw new Error('Select a host before installing');
23
+ if (codexHome && !path.isAbsolute(codexHome)) throw new Error('CODEX_HOME must be absolute');
24
+ return { config: ide === 'codex' && codexHome ? path.join(codexHome, 'config.toml') : path.join(home, host.config), skill: path.join(home, host.skills, 'craft-create', 'SKILL.md') };
25
+ }
26
+
27
+ export function projectSkillPath(ide) {
28
+ const host = hosts[clientIde(ide)];
29
+ return host ? host.projectSkills + '/craft-project/SKILL.md' : null;
30
+ }