file-upload
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFile upload
文件上传
Publish one local file through the configured file host and return a URL the
human can open. Public links serve from the host's public base URL without
auth; the link for a key never changes.
通过配置的文件托管服务发布一个本地文件,并返回一个可供用户打开的URL。公共链接从托管服务的公共基础URL提供,无需身份验证;每个密钥对应的链接永久不变。
Requires
必要条件
FILE_HOST_URLFILE_HOST_TOKEN~/.agents/.envFILE_HOST_URLFILE_HOST_TOKEN~/.agents/.envSteps
步骤
- Confirm the file exists on this machine.
- Run the script that sits next to this SKILL.md (invoke via , the exec bit may be missing on a fresh copy):
sh
bash
sh <path-to-this-skill>/scripts/upload.sh /path/to/file- Key choice: by default the key is derived from the filename and stays
readable (generated collisions get ,
-2, …). Add-3for an exact key (fails with 409 if taken) or--slug NAMEfor a UUID key when the link should not be guessable.--random - Treat stdout as the public URL. If the script exits non-zero, stop and report stderr.
- Never claim a public URL for a or
file://path.artifacts/
- 确认文件存在于本地机器上。
- 运行与本SKILL.md同级的脚本(通过调用,新副本可能缺少执行权限):
sh
bash
sh <path-to-this-skill>/scripts/upload.sh /path/to/file- 密钥选择:默认情况下,密钥由文件名生成且保持可读(若产生冲突则追加、
-2……)。若需要指定确切密钥,添加-3(若已被占用则返回409错误);若希望链接不可被猜测,添加--slug NAME以生成UUID密钥。--random - 将标准输出视为公共URL。如果脚本非零退出,停止操作并报告标准错误信息。
- 切勿为或
file://路径声称是公共URL。artifacts/
Replace or delete
替换或删除
KEY is the last segment of the public URL. An update swaps the content behind
the same link — no history. Delete is permanent and idempotent.
bash
sh <path-to-this-skill>/scripts/upload.sh --update KEY /path/to/file
sh <path-to-this-skill>/scripts/upload.sh --delete KEYKEY是公共URL的最后一段。更新操作会替换同一链接后的内容——不保留历史记录。删除操作是永久性的且幂等。
bash
sh <path-to-this-skill>/scripts/upload.sh --update KEY /path/to/file
sh <path-to-this-skill>/scripts/upload.sh --delete KEYUsing the URL
URL的使用
- PR or chat: paste the URL. For video, a short sentence plus the link is enough.
- Optional GIF preview with ffmpeg only when the user asked for a preview image.
- PR或聊天:粘贴URL。对于视频,只需简短说明加链接即可。
- 仅当用户要求预览图片时,可使用ffmpeg生成可选的GIF预览。
Local fallback
本地回退方案
Without a host, the script copies to (gitignored,
created if missing) and prints a path. On a Mac with a display you
may that path if the user wants to see it. On a headless machine or
cloud VM, just return the path.
~/.agents/artifacts/file://open若没有托管服务,脚本会将文件复制到(已被git忽略,若不存在则自动创建)并打印路径。在带显示器的Mac上,如果用户想要查看,你可以该路径。在无头机器或云虚拟机上,只需返回路径即可。
~/.agents/artifacts/file://open