关于 remix-upload-game
用于将完成的 HTML 游戏上传到 Remix 平台的工作流技能。它会验证文件、按需创建游戏条目,并通过 CLI 或 REST API 上传代码。
主要功能
- 01定位 HTML 游戏文件
- 02检查 Remix 游戏要求
- 03创建游戏条目
- 04通过 CLI 或 REST 上传代码
- 05检查版本和启动准备情况
适用场景
- 01将完成的游戏上传到 Remix
- 02部署前验证游戏
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ farworld-labs/ remix-skills --skill remix-upload-game安装后在 Claude Code 中输入/remix-upload-game确认已加载。
详细介绍
上传游戏工作流
概述
本技能将指导你将已完成的 HTML 游戏上传到 Remix 平台。内容包括创建游戏条目(如有需要)并上传代码。
前提条件
- 已完成且可供上传的 HTML 游戏文件。
- 在终端工作流中,优先使用官方 CLI:
remix loginremix games create --name "..."remix games versions code update --code-path ./game.html
步骤
1. 定位游戏文件
找到要上传的 HTML 文件路径。该文件应为一个包含内联 CSS 和 JS 的独立 HTML 文档。
2. 验证
读取 HTML 文件并确认:
- 包含
<!DOCTYPE html>声明 - 包含
<meta name="viewport" ...>标签 - 包含 RemixSDK 脚本标签:
<script src="https://cdn.jsdelivr.net/npm/@remix-gg/sdk@latest/dist/index.min.js"></script> - 不包含旧版
@farcade/game-sdk脚本标签 - 调用
singlePlayer.actions.gameOver(或multiplayer.actions.gameOver((不能同时调用两者) - 注册
.onPlayAgain(回调 - 注册
.onToggleMute(回调 - 不使用
localStorage或sessionStorage - 不包含内联事件处理器(
onclick=、onload=等)
继续操作前,请修复所有报告的问题。
3. 创建游戏(如有需要)
如果任务上下文或之前的工具结果中有 gameId 和 versionId,请优先使用。
否则,检查最近的 .remix-cli.json。较旧的项目可能仍使用
.remix-mcp.json。如果其中任一文件已包含 gameId 和 versionId,请跳过创建并继续第 4 步。
如果这些来源都没有提供 ID,请通过 CLI 或 REST 创建游戏。
CLI:
remix games create --name "My Game"
REST:
POST https://api.remix.gg/v1/games
Authorization: Bearer $REMIX_API_KEY
Content-Type: application/json
{ "name": "<game name>" }
响应会返回 游戏 ID 和 版本 ID。
创建成功后,将返回的 ID 写入 .remix-cli.json:
{
"gameId": "<returned game ID>",
"versionId": "<returned version ID>",
"name": "<game name>"
}
4. 上传代码
从任务上下文、之前的工具结果、.remix-cli.json 或旧版 .remix-mcp.json 中读取 gameId 和 versionId。
优先使用 CLI:
remix games versions code update --code-path ./game.html
remix games versions validate get
remix games launch-readiness get
读取 HTML 文件,并将其内容作为请求正文中的 code 字段传入:
POST https://api.remix.gg/v1/games/{gameId}/versions/{versionId}/code
Authorization: Bearer $REMIX_API_KEY
Content-Type: application/json
{ "code": "<HTML file contents>" }
响应会返回确认信息,其中包含游戏 ID、版本 ID 和线程 ID。
提示
- 上传前务必进行验证,以便尽早发现问题。
- 可以根据需要多次将代码重新上传到同一版本。
remix games versions status get和remix games versions thread get是实用的上传后检查命令。- 如果需要新的草稿,请创建新的游戏条目,而不是臆造版本创建接口。
评论
支持 Markdown