spritecook-upload-assets

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

SpriteCook Upload Assets

SpriteCook 资产上传

Use this skill when a local image file should become a reusable SpriteCook
asset_id
.
Pair it with
spritecook-workflow-essentials
for credential safety, manifests, and downstream asset reuse.
当需要将本地图片文件转换为可复用的SpriteCook
asset_id
时,使用此技能。
搭配
spritecook-workflow-essentials
使用,可保障凭证安全、管理清单并实现下游资产复用。

Preferred Flow

推荐流程

  1. Inspect the local file path without printing file bytes.
  2. Determine
    file_name
    , MIME
    content_type
    , optional
    size_bytes
    , and whether
    pixel
    should be true.
  3. Call
    create_asset_upload(file_name=..., content_type=..., pixel=..., size_bytes=...)
    .
  4. Upload the file bytes to the returned
    upload_url
    with HTTP
    PUT
    and the returned headers.
  5. Call
    finalize_asset_upload(upload_token=...)
    .
  6. Use the returned
    asset_id
    in the next SpriteCook tool.
The upload URL and token are short-lived secrets. Do not print them in user-facing prose, save them to project files, or include them in manifests.
  1. 检查本地文件路径,无需打印文件字节。
  2. 确定
    file_name
    、MIME类型
    content_type
    、可选的
    size_bytes
    ,以及是否将
    pixel
    设为true。
  3. 调用
    create_asset_upload(file_name=..., content_type=..., pixel=..., size_bytes=...)
  4. 通过HTTP
    PUT
    请求及返回的头部信息,将文件字节上传至返回的
    upload_url
  5. 调用
    finalize_asset_upload(upload_token=...)
  6. 在后续SpriteCook工具中使用返回的
    asset_id
上传URL和令牌是短期保密信息。请勿在面向用户的文本中打印它们,也不要将其保存到项目文件或包含在清单中。

PowerShell Pattern

PowerShell 模式

On Windows, upload without printing bytes:
powershell
Invoke-WebRequest -Method Put -Uri $uploadUrl -InFile $path -ContentType $contentType | Out-Null
Use variables for
$uploadUrl
,
$path
, and
$contentType
; do not echo them if they include the upload token.
在Windows系统中,无需打印字节即可上传:
powershell
Invoke-WebRequest -Method Put -Uri $uploadUrl -InFile $path -ContentType $contentType | Out-Null
使用变量存储
$uploadUrl
$path
$contentType
;如果这些变量包含上传令牌,请勿回显它们。

When To Use Inline Import

何时使用内联导入

Use
import_asset(image=...)
only when the image is already a small data URL or base64 value that can be passed directly without logging it.
Do not use shell commands that print base64 to the terminal. If encoding is necessary, store the value in memory or a private variable and pass it directly to the MCP tool.
仅当图片已为小型数据URL或base64值,且无需记录即可直接传递时,才使用
import_asset(image=...)
请勿使用会将base64打印到终端的shell命令。如果需要编码,请将值存储在内存或私有变量中,并直接传递给MCP工具。

Reusing Uploaded Assets

复用已上传资产

  • Use
    reference_asset_id
    when the uploaded asset is one specific source or context image.
  • Use
    edit_asset_id
    only when the uploaded asset is the one image being directly modified.
  • Use
    style_asset_ids
    on
    generate_game_art
    when uploaded assets are ambient style guides; pass up to 10 IDs.
  • Use
    style_asset_id
    on
    generate_tileset
    for one tileset style guide image.
  • Use
    asset_id
    on
    animate_game_art
    when the uploaded asset is the source to animate.
Save the returned
asset_id
and a local file hash in the project manifest when the workspace is writable.
  • 当已上传资产为特定源图或上下文图片时,使用
    reference_asset_id
  • 仅当已上传资产为直接修改的图片时,使用
    edit_asset_id
  • generate_game_art
    中使用
    style_asset_ids
    ,当已上传资产为环境样式指南时;最多可传递10个ID。
  • generate_tileset
    中使用
    style_asset_id
    ,对应一个tileset样式指南图片。
  • animate_game_art
    中使用
    asset_id
    ,当已上传资产为动画源文件时。
当工作区可写时,将返回的
asset_id
和本地文件哈希值保存到项目清单中。