@craft_eco/craft-mcp 0.1.34-beta.1 → 0.1.34-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/bin/craft-mcp.mjs +28 -2
- package/dist-server/game-workflow/art-previews.mjs +71 -0
- package/dist-server/game-workflow/bundle-files.mjs +12 -3
- package/dist-server/game-workflow/bundle-template.mjs +37 -37
- package/dist-server/game-workflow/local-context.mjs +64 -62
- package/dist-server/game-workflow/native-context.mjs +18 -5
- package/dist-server/game-workflow/project-art-previews.mjs +63 -0
- package/dist-server/game-workflow/project-bundles.mjs +97 -21
- package/dist-server/game-workflow/project-context.mjs +9 -8
- package/dist-server/game-workflow/project-install.mjs +2 -1
- package/dist-server/game-workflow/projects.mjs +15 -13
- package/dist-server/integrations/config.mjs +41 -18
- package/dist-server/integrations/connect.mjs +18 -9
- package/dist-server/integrations/connection-handoff.mjs +9 -8
- package/dist-server/integrations/dsh-config.mjs +30 -14
- package/dist-server/integrations/files.mjs +3 -1
- package/dist-server/integrations/fixed-launcher.mjs +1 -0
- package/dist-server/integrations/host-config-scope.mjs +4 -3
- package/dist-server/integrations/hosts.mjs +3 -1
- package/dist-server/integrations/install-source.mjs +44 -0
- package/dist-server/integrations/install.mjs +183 -53
- package/dist-server/integrations/installation-state.mjs +2 -1
- package/dist-server/integrations/instance-skill.mjs +26 -0
- package/dist-server/integrations/instance.mjs +29 -0
- package/dist-server/integrations/launcher-start.mjs +1 -1
- package/dist-server/integrations/login-task-command.mjs +3 -3
- package/dist-server/integrations/opencode-config.mjs +13 -6
- package/dist-server/integrations/project-setup.mjs +52 -22
- package/dist-server/integrations/runtime.mjs +2 -1
- package/dist-server/integrations/uninstall.mjs +160 -0
- package/dist-server/integrations/updates.mjs +57 -28
- package/dist-server/launcher.mjs +18 -2
- package/dist-server/mcp/server.mjs +18 -9
- package/dist-server/mcp/update-session.mjs +35 -18
- package/dist-server/upstream/craft-aigc.mjs +11 -2
- package/dist-server/upstream/draft-audit.mjs +52 -6
- package/package.json +4 -2
- package/resources/context-filter-report.json +1 -1
- package/resources/craft-create/SKILL.md +25 -23
- package/resources/craft-update/SKILL.md +27 -25
- package/resources/targets/claude/js/context-filter-report.json +1 -1
- package/resources/targets/claude/js/js/bundle.json +5 -5
- package/resources/targets/claude/js/recovery.md +1 -1
- package/resources/targets/claude/js/target.json +1 -1
- package/resources/targets/claude/js3d/context-filter-report.json +1 -1
- package/resources/targets/claude/js3d/js3d/bundle.json +25 -23
- package/resources/targets/claude/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
- package/resources/targets/claude/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
- package/resources/targets/claude/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
- package/resources/targets/claude/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
- package/resources/targets/claude/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
- package/resources/targets/claude/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
- package/resources/targets/claude/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
- package/resources/targets/claude/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
- package/resources/targets/claude/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
- package/resources/targets/claude/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
- package/resources/targets/claude/js3d/recovery.md +1 -1
- package/resources/targets/claude/js3d/target.json +1 -1
- package/resources/targets/codebuddy/js/context-filter-report.json +1 -1
- package/resources/targets/codebuddy/js/js/bundle.json +5 -5
- package/resources/targets/codebuddy/js/recovery.md +1 -1
- package/resources/targets/codebuddy/js/target.json +1 -1
- package/resources/targets/codebuddy/js3d/context-filter-report.json +1 -1
- package/resources/targets/codebuddy/js3d/js3d/bundle.json +25 -23
- package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
- package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
- package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
- package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
- package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
- package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
- package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
- package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
- package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
- package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
- package/resources/targets/codebuddy/js3d/recovery.md +1 -1
- package/resources/targets/codebuddy/js3d/target.json +1 -1
- package/resources/targets/codex/js/context-filter-report.json +1 -1
- package/resources/targets/codex/js/js/bundle.json +5 -5
- package/resources/targets/codex/js/recovery.md +1 -1
- package/resources/targets/codex/js/target.json +1 -1
- package/resources/targets/codex/js3d/context-filter-report.json +1 -1
- package/resources/targets/codex/js3d/js3d/bundle.json +25 -23
- package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
- package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
- package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
- package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
- package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
- package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
- package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
- package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
- package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
- package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
- package/resources/targets/codex/js3d/recovery.md +1 -1
- package/resources/targets/codex/js3d/target.json +1 -1
- package/resources/targets/comate/js/context-filter-report.json +1 -1
- package/resources/targets/comate/js/js/bundle.json +5 -5
- package/resources/targets/comate/js/recovery.md +1 -1
- package/resources/targets/comate/js/target.json +1 -1
- package/resources/targets/comate/js3d/context-filter-report.json +1 -1
- package/resources/targets/comate/js3d/js3d/bundle.json +25 -23
- package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
- package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
- package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
- package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
- package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
- package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
- package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
- package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
- package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
- package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
- package/resources/targets/comate/js3d/recovery.md +1 -1
- package/resources/targets/comate/js3d/target.json +1 -1
- package/resources/targets/cursor/js/context-filter-report.json +1 -1
- package/resources/targets/cursor/js/js/bundle.json +5 -5
- package/resources/targets/cursor/js/recovery.md +1 -1
- package/resources/targets/cursor/js/target.json +1 -1
- package/resources/targets/cursor/js3d/context-filter-report.json +1 -1
- package/resources/targets/cursor/js3d/js3d/bundle.json +25 -23
- package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
- package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
- package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
- package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
- package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
- package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
- package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
- package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
- package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
- package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
- package/resources/targets/cursor/js3d/recovery.md +1 -1
- package/resources/targets/cursor/js3d/target.json +1 -1
- package/resources/targets/dsh/js/context-filter-report.json +1 -1
- package/resources/targets/dsh/js/js/bundle.json +5 -5
- package/resources/targets/dsh/js/recovery.md +1 -1
- package/resources/targets/dsh/js/target.json +1 -1
- package/resources/targets/dsh/js3d/context-filter-report.json +1 -1
- package/resources/targets/dsh/js3d/js3d/bundle.json +25 -23
- package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
- package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
- package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
- package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
- package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
- package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
- package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
- package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
- package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
- package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
- package/resources/targets/dsh/js3d/recovery.md +1 -1
- package/resources/targets/dsh/js3d/target.json +1 -1
- package/resources/targets/index.json +56 -56
- package/resources/targets/kimi/js/context-filter-report.json +1 -1
- package/resources/targets/kimi/js/js/bundle.json +5 -5
- package/resources/targets/kimi/js/recovery.md +1 -1
- package/resources/targets/kimi/js/target.json +1 -1
- package/resources/targets/kimi/js3d/context-filter-report.json +1 -1
- package/resources/targets/kimi/js3d/js3d/bundle.json +25 -23
- package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
- package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
- package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
- package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
- package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
- package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
- package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
- package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
- package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
- package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
- package/resources/targets/kimi/js3d/recovery.md +1 -1
- package/resources/targets/kimi/js3d/target.json +1 -1
- package/resources/targets/opencode/js/context-filter-report.json +1 -1
- package/resources/targets/opencode/js/js/bundle.json +5 -5
- package/resources/targets/opencode/js/recovery.md +1 -1
- package/resources/targets/opencode/js/target.json +1 -1
- package/resources/targets/opencode/js3d/context-filter-report.json +1 -1
- package/resources/targets/opencode/js3d/js3d/bundle.json +25 -23
- package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
- package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
- package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
- package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
- package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
- package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
- package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
- package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
- package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
- package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
- package/resources/targets/opencode/js3d/recovery.md +1 -1
- package/resources/targets/opencode/js3d/target.json +1 -1
- package/resources/targets/qoder/js/context-filter-report.json +1 -1
- package/resources/targets/qoder/js/js/bundle.json +5 -5
- package/resources/targets/qoder/js/recovery.md +1 -1
- package/resources/targets/qoder/js/target.json +1 -1
- package/resources/targets/qoder/js3d/context-filter-report.json +1 -1
- package/resources/targets/qoder/js3d/js3d/bundle.json +25 -23
- package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
- package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
- package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
- package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
- package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
- package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
- package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
- package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
- package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
- package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
- package/resources/targets/qoder/js3d/recovery.md +1 -1
- package/resources/targets/qoder/js3d/target.json +1 -1
- package/resources/targets/qoder-cn/js/context-filter-report.json +1 -1
- package/resources/targets/qoder-cn/js/js/bundle.json +5 -5
- package/resources/targets/qoder-cn/js/recovery.md +1 -1
- package/resources/targets/qoder-cn/js/target.json +1 -1
- package/resources/targets/qoder-cn/js3d/context-filter-report.json +1 -1
- package/resources/targets/qoder-cn/js3d/js3d/bundle.json +25 -23
- package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
- package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
- package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
- package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
- package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
- package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
- package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
- package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
- package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
- package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
- package/resources/targets/qoder-cn/js3d/recovery.md +1 -1
- package/resources/targets/qoder-cn/js3d/target.json +1 -1
- package/resources/targets/qwen/js/context-filter-report.json +1 -1
- package/resources/targets/qwen/js/js/bundle.json +5 -5
- package/resources/targets/qwen/js/recovery.md +1 -1
- package/resources/targets/qwen/js/target.json +1 -1
- package/resources/targets/qwen/js3d/context-filter-report.json +1 -1
- package/resources/targets/qwen/js3d/js3d/bundle.json +25 -23
- package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
- package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
- package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
- package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
- package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
- package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
- package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
- package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
- package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
- package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
- package/resources/targets/qwen/js3d/recovery.md +1 -1
- package/resources/targets/qwen/js3d/target.json +1 -1
- package/resources/targets/trae/js/context-filter-report.json +1 -1
- package/resources/targets/trae/js/js/bundle.json +5 -5
- package/resources/targets/trae/js/recovery.md +1 -1
- package/resources/targets/trae/js/target.json +1 -1
- package/resources/targets/trae/js3d/context-filter-report.json +1 -1
- package/resources/targets/trae/js3d/js3d/bundle.json +25 -23
- package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
- package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
- package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
- package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
- package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
- package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
- package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
- package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
- package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
- package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
- package/resources/targets/trae/js3d/recovery.md +1 -1
- package/resources/targets/trae/js3d/target.json +1 -1
- package/resources/targets/workbuddy/js/context-filter-report.json +1 -1
- package/resources/targets/workbuddy/js/js/bundle.json +5 -5
- package/resources/targets/workbuddy/js/recovery.md +1 -1
- package/resources/targets/workbuddy/js/target.json +1 -1
- package/resources/targets/workbuddy/js3d/context-filter-report.json +1 -1
- package/resources/targets/workbuddy/js3d/js3d/bundle.json +25 -23
- package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
- package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
- package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
- package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
- package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
- package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
- package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
- package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
- package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
- package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
- package/resources/targets/workbuddy/js3d/recovery.md +1 -1
- package/resources/targets/workbuddy/js3d/target.json +1 -1
- package/resources/targets/zcode/js/context-filter-report.json +1 -1
- package/resources/targets/zcode/js/js/bundle.json +5 -5
- package/resources/targets/zcode/js/recovery.md +1 -1
- package/resources/targets/zcode/js/target.json +1 -1
- package/resources/targets/zcode/js3d/context-filter-report.json +1 -1
- package/resources/targets/zcode/js3d/js3d/bundle.json +25 -23
- package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/SKILL.md +1 -1
- package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/references/sources.md +1 -1
- package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/references/styles/cartoon.md +1 -1
- package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/references/styles/comic.md +1 -1
- package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/references/styles/cozy.md +1 -1
- package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/references/styles/cyber.md +1 -1
- package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/references/styles/horror.md +1 -1
- package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/references/styles/lowpoly.md +1 -1
- package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/references/styles/paper.md +1 -1
- package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/references/styles/voxel.md +1 -1
- package/resources/targets/zcode/js3d/recovery.md +1 -1
- package/resources/targets/zcode/js3d/target.json +1 -1
- package/vendor/craft-runtime/SOURCE.json +1 -1
- package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
- package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
- package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
- package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
- package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
- package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
- package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
- package/resources/targets/codebuddy/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
- package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
- package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
- package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
- package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
- package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
- package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
- package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
- package/resources/targets/codex/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
- package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
- package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
- package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
- package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
- package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
- package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
- package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
- package/resources/targets/comate/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
- package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
- package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
- package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
- package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
- package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
- package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
- package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
- package/resources/targets/cursor/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
- package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
- package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
- package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
- package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
- package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
- package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
- package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
- package/resources/targets/dsh/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
- package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
- package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
- package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
- package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
- package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
- package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
- package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
- package/resources/targets/kimi/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
- package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
- package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
- package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
- package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
- package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
- package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
- package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
- package/resources/targets/opencode/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
- package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
- package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
- package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
- package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
- package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
- package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
- package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
- package/resources/targets/qoder/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
- package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
- package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
- package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
- package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
- package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
- package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
- package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
- package/resources/targets/qoder-cn/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
- package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
- package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
- package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
- package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
- package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
- package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
- package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
- package/resources/targets/qwen/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
- package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
- package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
- package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
- package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
- package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
- package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
- package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
- package/resources/targets/trae/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
- package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
- package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
- package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
- package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
- package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
- package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
- package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
- package/resources/targets/workbuddy/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
- package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp +0 -0
- package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp +0 -0
- package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp +0 -0
- package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp +0 -0
- package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp +0 -0
- package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp +0 -0
- package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp +0 -0
- package/resources/targets/zcode/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp +0 -0
- /package/resources/{targets/claude/js3d/js3d/context/skills/game-art-style/assets/previews/cartoon.webp → shared-art-previews/cartoon-3f9e1acaf11be3a7ffdaac90802f591a9563724e742cc5891284ef1ee8b67ee9.webp} +0 -0
- /package/resources/{targets/claude/js3d/js3d/context/skills/game-art-style/assets/previews/comic.webp → shared-art-previews/comic-77969cf47f2600424b5c64ef20930ba7b7081df3a5640608855913bbb99cea63.webp} +0 -0
- /package/resources/{targets/claude/js3d/js3d/context/skills/game-art-style/assets/previews/cozy.webp → shared-art-previews/cozy-e5fcba518afcf147c289b58b94a3532b30d96ab48418cc95efc1f28e9f80a90c.webp} +0 -0
- /package/resources/{targets/claude/js3d/js3d/context/skills/game-art-style/assets/previews/cyber.webp → shared-art-previews/cyber-8e6934fed1a42ed08838ac8bfaaf8f1d9b10c29c23c5843895c0791412ad3d2b.webp} +0 -0
- /package/resources/{targets/claude/js3d/js3d/context/skills/game-art-style/assets/previews/horror.webp → shared-art-previews/horror-041ee4c51839b38a71517a4608d94fa64b860cd9d8500e5c6fa983bd00a0e7c7.webp} +0 -0
- /package/resources/{targets/claude/js3d/js3d/context/skills/game-art-style/assets/previews/lowpoly.webp → shared-art-previews/lowpoly-206f350338c6c1a890981e2e35ee9bc600951701d01f2e823a259c5b5c241a08.webp} +0 -0
- /package/resources/{targets/claude/js3d/js3d/context/skills/game-art-style/assets/previews/paper.webp → shared-art-previews/paper-98dff3c4d5d493730af33e38777721c8a6c46c222e8f4d9f3b3c6f0f36fe19d1.webp} +0 -0
- /package/resources/{targets/claude/js3d/js3d/context/skills/game-art-style/assets/previews/voxel.webp → shared-art-previews/voxel-2bbe76b02f1f69059ab676eb6e2f89d0a25dd405dcab80acfc2d96f4e483098d.webp} +0 -0
package/README.md
CHANGED
|
@@ -8,18 +8,18 @@ Craft MCP 是面向支持本地 stdio MCP 的 AI IDE 的游戏制作服务,例
|
|
|
8
8
|
|
|
9
9
|
### 按宿主安装(推荐)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
选择当前宿主;只有同时接入时才用逗号列出多个宿主。安装完整 MCP 程序包、固定启动入口及全局 craft-create、craft-update Skill,保留已有平台和工作区。
|
|
12
|
+
|
|
13
|
+
使用本次 guide 命令中的包选择器,将 guide 换为 install --ide <当前宿主>。正式安装使用 @stable。只有用户明确给出了其他渠道时,才沿用该标签并传同名 --channel;安装器为它创建独立的命名服务、工作区和 Skill。同一标签再次安装会复用自己的实例。明确指定版本时保留版本号。
|
|
12
14
|
|
|
13
15
|
```sh
|
|
14
|
-
#
|
|
15
|
-
npx --yes --registry=https://registry.npmjs.org/ @craft_eco/craft-mcp@
|
|
16
|
-
# 在 WorkBuddy 中安装
|
|
17
|
-
npx --yes --registry=https://registry.npmjs.org/ @craft_eco/craft-mcp@0.1.34-beta.1 install --ide workbuddy
|
|
16
|
+
# 正式版,在 Codex 中安装
|
|
17
|
+
npx --yes --registry=https://registry.npmjs.org/ @craft_eco/craft-mcp@stable install --ide codex
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
其他宿主将 --ide 改为 cursor、codebuddy、claude、dsh、zcode、kimi、trae、qoder-cn、qoder、comate、opencode 或 qwen。TRAE 与国际版 Qoder IDE 还须 --host-config <宿主设置中打开的 MCP 配置绝对路径>;TRAE CN 加 --trae-region cn,国际版默认 global。这两个选项也适用于 doctor/check/update/connect/project-setup,可由 CRAFT_HOST_CONFIG、CRAFT_TRAE_REGION 环境变量提供。kimi 指当前 Kimi Code CLI,不写旧 Python Kimi CLI 的 ~/.kimi。可用 --workspace <绝对游戏父目录> 和 --platform <HTTPS origin> 指定目录与平台;未提供时保留现有配置,新安装默认 ~/CraftGames
|
|
20
|
+
其他宿主将 --ide 改为 cursor、codebuddy、claude、dsh、zcode、kimi、trae、qoder-cn、qoder、comate、opencode 或 qwen。TRAE 与国际版 Qoder IDE 还须 --host-config <宿主设置中打开的 MCP 配置绝对路径>;TRAE CN 加 --trae-region cn,国际版默认 global。这两个选项也适用于 doctor/check/update/connect/project-setup,可由 CRAFT_HOST_CONFIG、CRAFT_TRAE_REGION 环境变量提供。kimi 指当前 Kimi Code CLI,不写旧 Python Kimi CLI 的 ~/.kimi。可用 --workspace <绝对游戏父目录> 和 --platform <HTTPS origin> 指定目录与平台;未提供时保留现有配置,新安装默认 ~/CraftGames 和本包平台。安装不创建游戏、不修改信任权限。
|
|
21
21
|
|
|
22
|
-
Codex 配置 ~/.codex/config.toml(设置 CODEX_HOME 时使用其 config.toml),全局 Skill 在 ~/.agents/skills;WorkBuddy 配置 ~/.workbuddy/mcp.json,全局 Skill 在 ~/.workbuddy/skills。CodeBuddy 使用 ~/.codebuddy/.mcp.json 与 ~/.codebuddy/skills,已有旧 MCP
|
|
22
|
+
Codex 配置 ~/.codex/config.toml(设置 CODEX_HOME 时使用其 config.toml),全局 Skill 在 ~/.agents/skills;WorkBuddy 配置 ~/.workbuddy/mcp.json,全局 Skill 在 ~/.workbuddy/skills。CodeBuddy 使用 ~/.codebuddy/.mcp.json 与 ~/.codebuddy/skills,已有旧 MCP 配置按官方优先级沿用。安装或切换渠道后,在下次启动或重连时调用当前聊天的 craft_game_info,核对 update.source.channel、运行版本、build_id 和 active_verified。doctor --ide <当前宿主> 仅验证独立探测和文件,不证明当前聊天已切版或发现 Skill。
|
|
23
23
|
|
|
24
24
|
Claude Code 使用 ~/.claude.json 与 ~/.claude/skills;DSH 使用 ~/.dsh/cordis.patch.yml 与 ~/.dsh/skills;ZCode 使用 ~/.zcode/cli/config.json 的 mcp.servers 和 ~/.zcode/skills;Kimi Code CLI 使用 ~/.kimi-code/mcp.json 与 ~/.kimi-code/skills。DSH 配置是 YAML 插件 patch,ZCode 不是 mcpServers。对应目录覆盖通过 CLAUDE_CONFIG_DIR、DSH_HOME、KIMI_CODE_HOME 指定。不要把不同宿主的配置格式互换。
|
|
25
25
|
|
|
@@ -32,7 +32,7 @@ Claude Code 使用 ~/.claude.json 与 ~/.claude/skills;DSH 使用 ~/.dsh/cordi
|
|
|
32
32
|
执行本包 guide,根据当前宿主调用上面的标准 install。十四种宿主使用同一安装流程,无需选择连接模式。当前进程不会因安装新版而切换版本;固定入口在下次启动时读取已安装目标。
|
|
33
33
|
|
|
34
34
|
```sh
|
|
35
|
-
npx --yes --registry=https://registry.npmjs.org/ @craft_eco/craft-mcp@
|
|
35
|
+
npx --yes --registry=https://registry.npmjs.org/ @craft_eco/craft-mcp@stable guide
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
专家和连接器只通过 connect --ide workbuddy 解析标准安装并启动同一受管入口,首次使用也须先执行标准 install。connect 不安装程序、不改宿主配置、不创建游戏;安装缺失、禁用或平台/工作区不一致时明确失败。不要用无参数 npx 直接启动业务包来替代标准安装。未适配宿主的原始 stdio 调试不包含自动更新和 Skill 安装。
|
package/bin/craft-mcp.mjs
CHANGED
|
@@ -14,7 +14,33 @@ if (args.length === 0 || (args.length === 2 && args[0] === '--workspace' && path
|
|
|
14
14
|
if (args.length) process.env.CLIENT_WORKSPACE_ROOT = path.resolve(args[1]);
|
|
15
15
|
await import('../dist-server/mcp/start.mjs');
|
|
16
16
|
} else if (args.length === 1 && args[0] === 'guide') {
|
|
17
|
-
|
|
17
|
+
let guide = await readFile(new URL('../README.md', import.meta.url), 'utf8');
|
|
18
|
+
if (process.env.npm_command === 'exec' && process.env.npm_lifecycle_event === 'npx') {
|
|
19
|
+
const { npmInstallSelector } = await import('../dist-server/integrations/install-source.mjs');
|
|
20
|
+
const { serverIdForChannel } = await import('../dist-server/integrations/instance.mjs');
|
|
21
|
+
const pkg = JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8'));
|
|
22
|
+
const selector = await npmInstallSelector(fileURLToPath(new URL('..', import.meta.url)), pkg.name);
|
|
23
|
+
if (selector?.kind === 'tag' && !['stable', 'latest'].includes(selector.tag)) {
|
|
24
|
+
const tag = selector.tag;
|
|
25
|
+
const server = serverIdForChannel(tag);
|
|
26
|
+
guide = [
|
|
27
|
+
'# 安装用户指定的 Craft 实例', '',
|
|
28
|
+
'保留本次 npx 命令的 registry 和包选择器,将 guide 换为下列参数,并将占位符替换为当前宿主。', '',
|
|
29
|
+
' install --ide <当前宿主> --channel ' + tag + ' --instance ' + server, '',
|
|
30
|
+
'该服务拥有独立的工作区和 Skill。同一命令再次安装时更新该实例。安装完成后等待宿主连接 ' + server +
|
|
31
|
+
',在当前聊天用它的 craft_game_info 核对 server_id、channel、version、build_id、workspace 和 active_verified。',
|
|
32
|
+
'TRAE 和国际版 Qoder IDE 需追加 --host-config <从该宿主设置中打开的配置绝对路径>。TRAE 国内版另加 --trae-region cn。',
|
|
33
|
+
'新安装默认游戏目录为 ~/CraftTestGames/' + server + ',平台为 ' + pkg.craft.platform + '。安装器会保留该实例已有的平台和工作区。',
|
|
34
|
+
'在 CLI 中检查、更新、诊断或卸载时传 --ide <当前宿主> --instance ' + server + '。', '',
|
|
35
|
+
].join('\n');
|
|
36
|
+
} else if (selector?.kind === 'package') {
|
|
37
|
+
guide = guide.replaceAll(pkg.name + '@stable ', pkg.name + '@' + pkg.version + ' ');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
process.stdout.write(guide);
|
|
41
|
+
} else if (args[0] === 'uninstall') {
|
|
42
|
+
try { const { runUninstallCommand } = await import('../dist-server/integrations/uninstall.mjs'); await runUninstallCommand(args); }
|
|
43
|
+
catch (error) { process.stderr.write('Craft uninstall failed: ' + error.message + '\n'); process.exitCode = 1; }
|
|
18
44
|
} else if (args[0] === 'connect') {
|
|
19
45
|
try { const { runConnectCommand } = await import('../dist-server/integrations/connect.mjs'); await runConnectCommand(args); }
|
|
20
46
|
catch (error) { process.stderr.write('Craft connect failed: ' + error.message + '\n'); process.exitCode = 1; }
|
|
@@ -37,7 +63,7 @@ if (args.length === 0 || (args.length === 2 && args[0] === '--workspace' && path
|
|
|
37
63
|
} else if (args.length === 1 && ['--help', '-h', 'help'].includes(args[0])) {
|
|
38
64
|
process.stdout.write('Windows local login: craft-mcp login-task --setup|--remove --ide workbuddy [--host-config <absolute MCP config file>]\n');
|
|
39
65
|
process.stdout.write('Windows game preview: craft-mcp preview-task --setup|--remove --ide workbuddy [--host-config <absolute MCP config file>]\n');
|
|
40
|
-
process.stdout.write('Usage: craft-mcp [--workspace <absolute games directory>|guide|--help]\n craft-mcp install --ide <host[,host]> [--workspace <absolute games directory>] [--platform <HTTPS origin>] [--registry <HTTPS registry>] [--channel <npm tag>] [--updates auto|off]\n craft-mcp project-setup --project <absolute game directory> --ide <host> [--install]\n craft-mcp connect --ide <host>\n craft-mcp doctor --ide <host[,host]>\n craft-mcp check --ide <host[,host]>\n craft-mcp update --ide <host[,host]>\nHosts: codex, workbuddy, codebuddy, cursor, claude, dsh, zcode, kimi, trae, qoder-cn, qoder, comate, opencode, qwen.\nHost options: --host-config <absolute MCP config file> (one host only); --trae-region global|cn. TRAE and Qoder IDE require the path opened by their settings UI. Environment equivalents: CRAFT_HOST_CONFIG, CRAFT_TRAE_REGION.\n\nNo arguments: start the stdio MCP server from this package.\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
|
|
66
|
+
process.stdout.write('Usage: craft-mcp [--workspace <absolute games directory>|guide|--help]\n craft-mcp install --ide <host[,host]> [--workspace <absolute games directory>] [--platform <HTTPS origin>] [--registry <HTTPS registry>] [--channel <npm tag>] [--updates auto|off]\n craft-mcp project-setup --project <absolute game directory> --ide <host> [--install]\n craft-mcp connect --ide <host>\n craft-mcp doctor --ide <host[,host]>\n craft-mcp check --ide <host[,host]>\n craft-mcp update --ide <host[,host]>\nHosts: codex, workbuddy, codebuddy, cursor, claude, dsh, zcode, kimi, trae, qoder-cn, qoder, comate, opencode, qwen.\nInstance selection: --instance <registered Craft server> for install, doctor, connect, project-setup, check, update or uninstall.\n craft-mcp uninstall --ide <host> [--instance <server>]\nHost options: --host-config <absolute MCP config file> (one host only); --trae-region global|cn. TRAE and Qoder IDE require the path opened by their settings UI. Environment equivalents: CRAFT_HOST_CONFIG, CRAFT_TRAE_REGION.\n\nNo arguments: start the stdio MCP server from this package.\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 and verify Craft, merge selected host configurations and install managed Skills. The default server is craft on stable. An explicit test tag selects its separate installation. Use --instance to target a specific managed registration. Reinstalling the same channel and automatic updates retain downgrade protection. Preserve the workspace, platform and update policy; new installations enable automatic updates.\nconnect: start the existing standard installation; never installs or rewrites host settings.\ncheck: inspect the configured npm channel without installing a new runtime.\nupdate: install a verified newer compatible runtime and update the host configuration, including when automatic updates are off. The current process stays on its original package. Load the target at the next MCP start or user-requested reconnect, verify its identity, then prepare the current project to update context and Skills.\nproject-setup: inspect portable project installation requirements and the selected host; --install installs only a missing registration. Verify the current host connection before resuming.\ndoctor: verify configured files and candidate MCP in an isolated process; does not confirm the current host connection.\n');
|
|
41
67
|
} else {
|
|
42
68
|
process.stderr.write('Unknown command or extra arguments. Use craft-mcp --help.\n');
|
|
43
69
|
process.exitCode = 1;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import { mkdir, readFile, writeFile, lstat } from 'node:fs/promises';
|
|
4
|
+
import { resolveBundleTemplate, sharedTemplatePath } from './bundle-template.mjs';
|
|
5
|
+
|
|
6
|
+
export const archiveArtPreviews = 'shared-art-previews';
|
|
7
|
+
export const projectArtPreviews = '.craft/art-previews';
|
|
8
|
+
|
|
9
|
+
export function previewHash(name) {
|
|
10
|
+
const match = typeof name === 'string' && /^[a-z][a-z0-9-]*-([a-f0-9]{64})\.webp$/.exec(name);
|
|
11
|
+
if (!match) throw new Error('Invalid Craft preview file name: '+name);
|
|
12
|
+
return match[1];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function checkArtPreview(name, bytes) {
|
|
16
|
+
if (createHash('sha256').update(bytes).digest('hex') !== previewHash(name)) throw new Error('Craft preview checksum mismatch: '+name);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Skill Markdown carries the final game-relative link verbatim. Only this
|
|
20
|
+
// content-addressed destination can cross the boundary of a native host tree.
|
|
21
|
+
export function artPreviewLink(file, target) {
|
|
22
|
+
if (!target.includes('.craft/art-previews/')) return;
|
|
23
|
+
const parts = file.replaceAll('\\','/').split('/');
|
|
24
|
+
const skills = parts.lastIndexOf('skills'), name = path.posix.basename(target);
|
|
25
|
+
previewHash(name);
|
|
26
|
+
const expected = path.posix.relative(path.posix.dirname(['host',...parts.slice(skills)].join('/')),projectArtPreviews+'/'+name);
|
|
27
|
+
if (skills < 0 || target !== expected) throw new Error('Invalid project-relative Craft preview link: '+target);
|
|
28
|
+
return name;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function collectArtPreviews(file, bytes, names) {
|
|
32
|
+
if (!file.endsWith('.md') || !bytes.includes('.craft/art-previews/')) return;
|
|
33
|
+
for (const [,target] of bytes.toString('utf8').matchAll(/\[[^\]\n]*\]\(([^)\n]+)\)/g)) {
|
|
34
|
+
const name = artPreviewLink(file,target);
|
|
35
|
+
if (name) names.add(name);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function bundleArtPreviewDirectory(root, engine, host, template) {
|
|
40
|
+
const target = path.resolve(root), hostRoot = path.dirname(target), targets = path.dirname(hostRoot);
|
|
41
|
+
const resources = path.dirname(targets);
|
|
42
|
+
// A standalone --out may happen to end in targets/<host>/<engine>. Only a
|
|
43
|
+
// verified shared distribution template opts into the sibling resource pool.
|
|
44
|
+
const shared = template && host && path.basename(target) === engine && path.basename(hostRoot) === host &&
|
|
45
|
+
path.basename(targets) === 'targets' && path.resolve(template) === path.join(resources,sharedTemplatePath(engine));
|
|
46
|
+
return path.join(shared ? resources : root,archiveArtPreviews);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export async function readArtPreview(directory,name) {
|
|
50
|
+
previewHash(name);
|
|
51
|
+
const file=path.join(directory,name);
|
|
52
|
+
if (!(await lstat(directory)).isDirectory() || !(await lstat(file)).isFile()) throw new Error('Craft preview must be a regular file: '+name);
|
|
53
|
+
const bytes = await readFile(file);
|
|
54
|
+
checkArtPreview(name,bytes);
|
|
55
|
+
return bytes;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export async function copyArtPreview(source,destination,name) {
|
|
59
|
+
const bytes = await readArtPreview(source,name);
|
|
60
|
+
await mkdir(destination,{recursive:true});
|
|
61
|
+
try {await writeFile(path.join(destination,name),bytes,{flag:'wx'});}
|
|
62
|
+
catch (error) {if (error.code !== 'EEXIST') throw error; await readArtPreview(destination,name);}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export async function copyBundleArtPreviews(source,destination,bundle) {
|
|
66
|
+
if (!bundle.art_previews?.length) return;
|
|
67
|
+
const template = await resolveBundleTemplate(source,bundle.engine,bundle.host);
|
|
68
|
+
for (const name of bundle.art_previews ?? []) {
|
|
69
|
+
await copyArtPreview(bundleArtPreviewDirectory(source,bundle.engine,bundle.host,template),path.join(destination,archiveArtPreviews),name);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -3,6 +3,7 @@ import { lstat, readdir, readFile } from 'node:fs/promises';
|
|
|
3
3
|
import { createHash } from 'node:crypto';
|
|
4
4
|
import { hosts } from '../integrations/hosts.mjs';
|
|
5
5
|
import { resolveBundleTemplate } from './bundle-template.mjs';
|
|
6
|
+
import { bundleArtPreviewDirectory, collectArtPreviews, readArtPreview } from './art-previews.mjs';
|
|
6
7
|
|
|
7
8
|
export const bundleContracts = Object.freeze({ export:1, skills:1, mcp:1, sdk_lifecycle:1 });
|
|
8
9
|
export const digest = value => createHash('sha256').update(value).digest('hex');
|
|
@@ -13,7 +14,7 @@ export function bundleId(manifest) {
|
|
|
13
14
|
|
|
14
15
|
// Hash the complete engine payload, including executable skills, hooks and template.
|
|
15
16
|
// Common workflow and the selected engine guide travel with each version as well.
|
|
16
|
-
export async function bundleFiles(root, engine, target = false, contextOnly = false, template = path.join(root,engine,'project')) {
|
|
17
|
+
export async function bundleFiles(root, engine, target = false, contextOnly = false, template = path.join(root,engine,'project'), previews = new Set()) {
|
|
17
18
|
if (!['js','js3d'].includes(engine)) throw new Error('Unsupported bundle engine');
|
|
18
19
|
const files = {};
|
|
19
20
|
async function visit(relative, file = path.join(root,relative)) {
|
|
@@ -21,7 +22,11 @@ export async function bundleFiles(root, engine, target = false, contextOnly = fa
|
|
|
21
22
|
if (stat.isSymbolicLink()) throw new Error('Context bundle contains a link: ' + relative);
|
|
22
23
|
if (stat.isDirectory()) {
|
|
23
24
|
for (const name of (await readdir(file)).sort()) await visit(relative + '/' + name,path.join(file,name));
|
|
24
|
-
} else if (stat.isFile())
|
|
25
|
+
} else if (stat.isFile()) {
|
|
26
|
+
const bytes = await readFile(file);
|
|
27
|
+
files[relative] = digest(bytes);
|
|
28
|
+
if (target && relative.startsWith(engine+'/context/skills/')) collectArtPreviews(relative,bytes,previews);
|
|
29
|
+
}
|
|
25
30
|
else throw new Error('Invalid context bundle file: ' + relative);
|
|
26
31
|
}
|
|
27
32
|
if ((await lstat(root)).isSymbolicLink() || (await lstat(path.join(root,engine))).isSymbolicLink() ||
|
|
@@ -48,7 +53,11 @@ export async function verifyBundle(root, engine, expectedId, {contextOnly = fals
|
|
|
48
53
|
if (!Object.hasOwn(hosts,manifest.host) || target.host !== manifest.host || target.engine !== engine || target.version !== manifest.version) throw new Error('Context target identity mismatch');
|
|
49
54
|
}
|
|
50
55
|
const template = contextOnly ? undefined : await resolveBundleTemplate(root,engine,manifest.schema === 2 ? manifest.host : undefined);
|
|
51
|
-
const
|
|
56
|
+
const previews = new Set();
|
|
57
|
+
const actual = await bundleFiles(root,engine,manifest.schema === 2,contextOnly,template,previews);
|
|
58
|
+
const ordered = [...previews].sort();
|
|
59
|
+
if (JSON.stringify(manifest.art_previews ?? []) !== JSON.stringify(ordered)) throw new Error('Context bundle art preview bindings differ: '+engine);
|
|
60
|
+
for (const name of ordered) await readArtPreview(bundleArtPreviewDirectory(root,engine,manifest.host,template),name);
|
|
52
61
|
const expected = contextOnly ? Object.fromEntries(Object.entries(manifest.files).filter(([name])=>!name.startsWith(engine+'/project/'))) : manifest.files;
|
|
53
62
|
if (JSON.stringify(actual) !== JSON.stringify(expected)) throw new Error('Context bundle integrity check failed: ' + engine);
|
|
54
63
|
return manifest;
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { lstat, readFile } from 'node:fs/promises';
|
|
3
|
-
|
|
4
|
-
export const sharedTemplateIndex = 'templates/index.json';
|
|
5
|
-
|
|
6
|
-
export function sharedTemplatePath(engine) {
|
|
7
|
-
if (!['js', 'js3d'].includes(engine)) throw new Error('Unsupported bundle engine');
|
|
8
|
-
return `templates/${engine}/project`;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function assertSharedTemplateIndex(index) {
|
|
12
|
-
if (index?.schema !== 1) throw new Error('Invalid shared template layout index');
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
async function statIfPresent(file) {
|
|
16
|
-
try { return await lstat(file); }
|
|
17
|
-
catch (error) { if (error.code !== 'ENOENT') throw error; }
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export async function resolveBundleTemplate(root, engine, host) {
|
|
21
|
-
const inline = path.join(root, engine, 'project');
|
|
22
|
-
const target = path.resolve(root);
|
|
23
|
-
const hostRoot = path.dirname(target);
|
|
24
|
-
const targets = path.dirname(hostRoot);
|
|
25
|
-
// Legacy resources, cached bundles and standalone targets have their own template.
|
|
26
|
-
if (!host || path.basename(target) !== engine || path.basename(hostRoot) !== host || path.basename(targets) !== 'targets') return inline;
|
|
27
|
-
const resources = path.dirname(targets);
|
|
28
|
-
const index = path.join(resources, sharedTemplateIndex);
|
|
29
|
-
const stat = await statIfPresent(index);
|
|
30
|
-
if (!stat) return inline;
|
|
31
|
-
if (!stat.isFile() || !(await lstat(path.dirname(index))).isDirectory()) throw new Error('Invalid shared template layout index');
|
|
32
|
-
assertSharedTemplateIndex(JSON.parse(await readFile(index, 'utf8')));
|
|
33
|
-
if (await statIfPresent(inline)) throw new Error('Shared template target also contains an inline template');
|
|
34
|
-
const template = path.join(resources, sharedTemplatePath(engine));
|
|
35
|
-
if (!(await lstat(path.dirname(template))).isDirectory()) throw new Error('Invalid shared template directory');
|
|
36
|
-
return template;
|
|
37
|
-
}
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { lstat, readFile } from 'node:fs/promises';
|
|
3
|
+
|
|
4
|
+
export const sharedTemplateIndex = 'templates/index.json';
|
|
5
|
+
|
|
6
|
+
export function sharedTemplatePath(engine) {
|
|
7
|
+
if (!['js', 'js3d'].includes(engine)) throw new Error('Unsupported bundle engine');
|
|
8
|
+
return `templates/${engine}/project`;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function assertSharedTemplateIndex(index) {
|
|
12
|
+
if (index?.schema !== 1) throw new Error('Invalid shared template layout index');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async function statIfPresent(file) {
|
|
16
|
+
try { return await lstat(file); }
|
|
17
|
+
catch (error) { if (error.code !== 'ENOENT') throw error; }
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export async function resolveBundleTemplate(root, engine, host) {
|
|
21
|
+
const inline = path.join(root, engine, 'project');
|
|
22
|
+
const target = path.resolve(root);
|
|
23
|
+
const hostRoot = path.dirname(target);
|
|
24
|
+
const targets = path.dirname(hostRoot);
|
|
25
|
+
// Legacy resources, cached bundles and standalone targets have their own template.
|
|
26
|
+
if (!host || path.basename(target) !== engine || path.basename(hostRoot) !== host || path.basename(targets) !== 'targets') return inline;
|
|
27
|
+
const resources = path.dirname(targets);
|
|
28
|
+
const index = path.join(resources, sharedTemplateIndex);
|
|
29
|
+
const stat = await statIfPresent(index);
|
|
30
|
+
if (!stat) return inline;
|
|
31
|
+
if (!stat.isFile() || !(await lstat(path.dirname(index))).isDirectory()) throw new Error('Invalid shared template layout index');
|
|
32
|
+
assertSharedTemplateIndex(JSON.parse(await readFile(index, 'utf8')));
|
|
33
|
+
if (await statIfPresent(inline)) throw new Error('Shared template target also contains an inline template');
|
|
34
|
+
const template = path.join(resources, sharedTemplatePath(engine));
|
|
35
|
+
if (!(await lstat(path.dirname(template))).isDirectory()) throw new Error('Invalid shared template directory');
|
|
36
|
+
return template;
|
|
37
|
+
}
|
|
@@ -1,62 +1,64 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { mkdir, mkdtemp, readFile, readdir, writeFile, lstat, rename, rm } from 'node:fs/promises';
|
|
3
|
-
import { randomUUID } from 'node:crypto';
|
|
4
|
-
import { safeProjectFile } from './asset-import.mjs';
|
|
5
|
-
import { verifyBundle } from './bundle-files.mjs';
|
|
6
|
-
import { loadEngineResource } from './engines.mjs';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (entry.
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
//
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
await
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { mkdir, mkdtemp, readFile, readdir, writeFile, lstat, rename, rm } from 'node:fs/promises';
|
|
3
|
+
import { randomUUID } from 'node:crypto';
|
|
4
|
+
import { safeProjectFile } from './asset-import.mjs';
|
|
5
|
+
import { verifyBundle } from './bundle-files.mjs';
|
|
6
|
+
import { loadEngineResource } from './engines.mjs';
|
|
7
|
+
import { copyBundleArtPreviews } from './art-previews.mjs';
|
|
8
|
+
|
|
9
|
+
export const localContextPath = (host,engine,id)=>`.craft/contexts/${host}/${engine}/${id}`;
|
|
10
|
+
|
|
11
|
+
// All parent components are checked using the same project boundary as game files.
|
|
12
|
+
async function directory(project, relative) {
|
|
13
|
+
const marker = await safeProjectFile(project,relative+'/.directory-check',true);
|
|
14
|
+
return path.dirname(marker);
|
|
15
|
+
}
|
|
16
|
+
async function noLinks(root) {
|
|
17
|
+
for (const entry of await readdir(root,{withFileTypes:true})) {
|
|
18
|
+
if (entry.isSymbolicLink() || (!entry.isDirectory() && !entry.isFile())) throw new Error('Project context contains a link or special file');
|
|
19
|
+
if (entry.isDirectory()) await noLinks(path.join(root,entry.name));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Immutable version directories keep an in-flight operation on the exact files it selected.
|
|
24
|
+
// Only the sync record switches after the new snapshot is complete and verified.
|
|
25
|
+
export async function materializeContext(project, current, previous) {
|
|
26
|
+
const {host,engine,bundle,resources} = current;
|
|
27
|
+
const relative = localContextPath(host,engine,bundle.id);
|
|
28
|
+
const parent = await directory(project,`.craft/contexts/${host}/${engine}`);
|
|
29
|
+
const target = path.join(parent,bundle.id);
|
|
30
|
+
let present = false, backup;
|
|
31
|
+
try {
|
|
32
|
+
const stat = await lstat(target);
|
|
33
|
+
if (!stat.isDirectory() || stat.isSymbolicLink()) throw new Error('Project context target must be a regular directory');
|
|
34
|
+
await noLinks(target);
|
|
35
|
+
present = true;
|
|
36
|
+
} catch (error) { if (error.code !== 'ENOENT') throw error; }
|
|
37
|
+
if (present) {
|
|
38
|
+
try {
|
|
39
|
+
const selected = await loadEngineResource(target,engine,bundle.id,host,{contextOnly:true});
|
|
40
|
+
return {selected,relative,materialized:false};
|
|
41
|
+
} catch (error) {
|
|
42
|
+
// Do not claim an arbitrary pre-existing directory as an owned context.
|
|
43
|
+
if (previous?.path !== relative) throw new Error('Unmanaged or incomplete project context at '+relative+'; preserve it before retrying', {cause:error});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const staging = await mkdtemp(path.join(parent,'.staging-'));
|
|
47
|
+
try {
|
|
48
|
+
const files = [...Object.keys(bundle.files).filter(name=>!name.startsWith(engine+'/project/')),engine+'/bundle.json'];
|
|
49
|
+
for (const name of files) {
|
|
50
|
+
const output = await safeProjectFile(staging,name,true);
|
|
51
|
+
await writeFile(output,await readFile(path.join(resources,name)),{flag:'wx'});
|
|
52
|
+
}
|
|
53
|
+
await copyBundleArtPreviews(resources,staging,bundle);
|
|
54
|
+
await verifyBundle(staging,engine,bundle.id,{contextOnly:true});
|
|
55
|
+
if (present) {
|
|
56
|
+
const backups = await directory(project,`.craft/context-backups/${host}/${engine}`);
|
|
57
|
+
backup = path.join(backups,bundle.id+'-'+randomUUID());
|
|
58
|
+
await rename(target,backup);
|
|
59
|
+
}
|
|
60
|
+
await rename(staging,target);
|
|
61
|
+
const selected = await loadEngineResource(target,engine,bundle.id,host,{contextOnly:true});
|
|
62
|
+
return {selected,relative,materialized:true,...(backup ? {backup} : {})};
|
|
63
|
+
} finally { await rm(staging,{recursive:true,force:true}); }
|
|
64
|
+
}
|
|
@@ -6,6 +6,7 @@ import { safeProjectFile } from './asset-import.mjs';
|
|
|
6
6
|
import { digest } from './bundle-files.mjs';
|
|
7
7
|
import { hosts } from '../integrations/hosts.mjs';
|
|
8
8
|
import { atomicJson } from './request-store.mjs';
|
|
9
|
+
import { projectArtPreviewsCurrent, prepareArtPreviews } from './project-art-previews.mjs';
|
|
9
10
|
|
|
10
11
|
export const contextLayoutSchema = 5;
|
|
11
12
|
// Schema 4 used one physical Buddy directory. Never validate a historical lock
|
|
@@ -80,16 +81,22 @@ export async function resolveNativeContext(project,current,lock) {
|
|
|
80
81
|
const binding=lock?.contexts?.[current.host];
|
|
81
82
|
if(lock?.schema!==contextLayoutSchema || binding?.bundle_id!==current.bundle.id || lock.active_hosts?.[nativeContextPath(current.host)]!==current.host) throw new Error('Project context requires preparation with the installed host runtime; run craft_game_prepare mode=resume');
|
|
82
83
|
const checked=await inspectNativeContext(project,current.host,current.engine,{full:true});
|
|
83
|
-
const expected=
|
|
84
|
-
const file=nativeContextFile(name,current.engine); return file ? [[file,hash]] : [];
|
|
85
|
-
}));
|
|
84
|
+
const expected=nativeFileHashes(current.bundle);
|
|
86
85
|
if(checked.integrity!=='valid' || checked.manifest.bundle_id!==binding.bundle_id || checked.manifest.source_revision!==binding.source_revision || !isDeepStrictEqual(checked.manifest.files,expected)) throw new Error('Project context integrity check failed: '+(checked.reason??'binding or manifest mismatch')+'; run craft_game_prepare mode=resume');
|
|
86
|
+
if(!isDeepStrictEqual(checked.manifest.art_previews,current.bundle.art_previews) || !await projectArtPreviewsCurrent(project,current.bundle.art_previews)) throw new Error('Project art previews require restoration; run craft_game_prepare mode=resume');
|
|
87
87
|
const selected=nativeSelection(project,current);
|
|
88
88
|
selected.context.hosts=Object.fromEntries(Object.entries(lock.active_hosts).map(([directory,host])=>[host,path.join(project,directory)]));
|
|
89
89
|
selected.context.user_rules=path.join(project,'.craft/user-rules.md');
|
|
90
90
|
return selected;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
export function nativeFileHashes(bundle) {
|
|
94
|
+
return Object.fromEntries(Object.entries(bundle.files).flatMap(([name,hash])=>{
|
|
95
|
+
const file=nativeContextFile(name,bundle.engine);
|
|
96
|
+
return file ? [[file,hash]] : [];
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
|
|
93
100
|
function validFileMap(value) {
|
|
94
101
|
return value && typeof value==='object' && !Array.isArray(value) && Object.entries(value).every(([name,hash])=>
|
|
95
102
|
typeof hash==='string' && /^[a-f0-9]{64}$/.test(hash) && name && !path.isAbsolute(name) &&
|
|
@@ -172,8 +179,12 @@ async function recoverNativeContextAt(project,relative,guard) {
|
|
|
172
179
|
const raw=await optional(journalFile);
|
|
173
180
|
if(!raw) return;
|
|
174
181
|
const job=JSON.parse(raw);
|
|
182
|
+
const backupHost=/^\.craft\/context-backups\/([a-z-]+)\/[a-f0-9-]{36}$/.exec(job.backup)?.[1];
|
|
183
|
+
// Schema 4 recorded WorkBuddy backups under its own ID for the shared .codebuddy directory.
|
|
184
|
+
const ownsBackup=backupHost && Object.hasOwn(hosts,backupHost) &&
|
|
185
|
+
(nativeContextPath(backupHost)===relative || schema4Paths[backupHost]===relative);
|
|
175
186
|
if(job.target!==relative || !/^\.craft\/context-staging\/[a-f0-9-]{36}$/.test(job.staging) ||
|
|
176
|
-
|
|
187
|
+
!ownsBackup || !/^[a-f0-9]{64}$/.test(job.bundle)) throw new Error('Invalid native context transaction');
|
|
177
188
|
if(job.schema===2) {
|
|
178
189
|
await publishFiles(project,job,guard);
|
|
179
190
|
await guard(); await rm(journalFile);
|
|
@@ -242,11 +253,13 @@ export async function materializeNativeContext(project,current,guard=async()=>{}
|
|
|
242
253
|
const bytes=await readFile(path.join(resources,name));
|
|
243
254
|
payload.set(output,bytes); files[output]=digest(bytes);
|
|
244
255
|
}
|
|
245
|
-
const manifest={schema:1,host,engine,version:bundle.version,bundle_id:bundle.id,source_revision:bundle.source_revision,
|
|
256
|
+
const manifest={schema:1,host,engine,version:bundle.version,bundle_id:bundle.id,source_revision:bundle.source_revision,
|
|
257
|
+
...(bundle.art_previews ? {art_previews:bundle.art_previews} : {}),files};
|
|
246
258
|
const manifestBytes=Buffer.from(JSON.stringify(manifest,null,2)+'\n');
|
|
247
259
|
for(const name of payload.keys()) if(before[name] && !owned?.files[name]) throw new Error('Unmanaged project context file at '+relative+'/'+name+'; preserve or relocate it before retrying');
|
|
248
260
|
const complete=owned && isDeepStrictEqual(owned,manifest) && Object.entries(files).every(([name,hash])=>before[name]===hash);
|
|
249
261
|
const selected=nativeSelection(project,current);
|
|
262
|
+
await prepareArtPreviews(project,current,guard);
|
|
250
263
|
if(complete) return {selected,relative,materialized:!!recovered,...recovered};
|
|
251
264
|
const token=randomUUID(), stagingRelative='.craft/context-staging/'+token, backupRelative='.craft/context-backups/'+host+'/'+token;
|
|
252
265
|
const staging=await directory(project,stagingRelative), backup=await directory(project,backupRelative);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { readFile, writeFile, rename, rm } from 'node:fs/promises';
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
import { digest } from './bundle-files.mjs';
|
|
4
|
+
import { safeProjectFile } from './asset-import.mjs';
|
|
5
|
+
import { previewHash, projectArtPreviews, bundleArtPreviewDirectory, readArtPreview } from './art-previews.mjs';
|
|
6
|
+
|
|
7
|
+
async function projectPreviewBytes(project,name) {
|
|
8
|
+
previewHash(name);
|
|
9
|
+
try {return await readFile(await safeProjectFile(project,projectArtPreviews+'/'+name));}
|
|
10
|
+
catch (error) {if (error.code !== 'ENOENT') throw error; return null;}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export async function projectArtPreviewsCurrent(project,names,checks=new Map()) {
|
|
14
|
+
for (const name of names ?? []) {
|
|
15
|
+
if (!checks.has(name)) checks.set(name,projectPreviewBytes(project,name).then(bytes=>bytes !== null && digest(bytes) === previewHash(name)));
|
|
16
|
+
if (!await checks.get(name)) return false;
|
|
17
|
+
}
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Keep the old lock until retirement finishes. An interrupted migration can
|
|
22
|
+
// retry: an already archived file is absent, and unrelated files are untouched.
|
|
23
|
+
export async function retireArtPreviews(project,previous,current,guard) {
|
|
24
|
+
const active = new Set(current);
|
|
25
|
+
for (const name of previous) {
|
|
26
|
+
if (active.has(name)) continue;
|
|
27
|
+
await guard();
|
|
28
|
+
const bytes = await projectPreviewBytes(project,name);
|
|
29
|
+
if (bytes === null || digest(bytes) !== previewHash(name)) continue;
|
|
30
|
+
const file = await safeProjectFile(project,projectArtPreviews+'/'+name);
|
|
31
|
+
const backup = await safeProjectFile(project,'.craft/context-backups/art-previews/'+randomUUID()+'/'+name,true);
|
|
32
|
+
await rename(file,backup);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export async function prepareArtPreviews(project,current,guard) {
|
|
37
|
+
for (const name of current.bundle.art_previews ?? []) {
|
|
38
|
+
const original = await projectPreviewBytes(project,name);
|
|
39
|
+
if (original !== null && digest(original) === previewHash(name)) continue;
|
|
40
|
+
const bytes = await readArtPreview(bundleArtPreviewDirectory(current.resources,current.engine,current.host,current.template),name);
|
|
41
|
+
await guard();
|
|
42
|
+
// This namespace is reserved for immutable, digest-named reference images.
|
|
43
|
+
// Preserve unexpected local content before repairing its official counterpart.
|
|
44
|
+
const token = randomUUID(), relative = projectArtPreviews+'/'+name;
|
|
45
|
+
if (original !== null) {
|
|
46
|
+
const backup = await safeProjectFile(project,'.craft/context-backups/art-previews/'+token+'/'+name,true);
|
|
47
|
+
await writeFile(backup,original,{flag:'wx'});
|
|
48
|
+
}
|
|
49
|
+
const destination = await safeProjectFile(project,relative,true);
|
|
50
|
+
// Prepare owns the project lock. Reuse its private staging slot on retry
|
|
51
|
+
// so a terminated writer cannot strand a partial image in the asset pool.
|
|
52
|
+
const temporary = await safeProjectFile(project,'.craft/context-staging/art-previews/'+name+'.tmp',true);
|
|
53
|
+
await rm(temporary,{force:true});
|
|
54
|
+
try {
|
|
55
|
+
await writeFile(temporary,bytes,{flag:'wx'});
|
|
56
|
+
await guard();
|
|
57
|
+
const latest = await projectPreviewBytes(project,name);
|
|
58
|
+
if (latest !== null && digest(latest) === previewHash(name)) continue;
|
|
59
|
+
if (latest === null ? original !== null : !original?.equals(latest)) throw new Error('Project art preview changed during restoration: '+name);
|
|
60
|
+
await rename(temporary,destination);
|
|
61
|
+
} finally {await rm(temporary,{force:true});}
|
|
62
|
+
}
|
|
63
|
+
}
|