HTML Deploy: 前端代码即时 Web 托管 - Openclaw Skills

作者:互联网

2026-04-20

AI教程

什么是 HTML Deploy?

HTML Deploy 是为开发者和 AI 代理设计的专业实用程序,旨在快速填补本地代码与实时预览之间的空白。通过利用 htmlcode.fun 服务,它允许用户在几秒钟内将原始 HTML 字符串或本地文件转换为可访问的公开链接。对于任何在无需构建复杂云基础设施的情况下需要快速原型制作或移动端测试的人来说,该工具是 Openclaw Skills 生态系统的重要组成部分。

无论您是实时生成网站的 AI 代理,还是需要分享快速模型的开发者,此技能都能将托管流程简化为单个命令。它消除了为简单的单页前端部署管理服务器或 CDN 配置的开销。

下载入口:https://github.com/openclaw/skills/tree/main/skills/520xiaomumu/html-deploy

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install html-deploy

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 html-deploy。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

HTML Deploy 应用场景

  • 与客户或团队成员分享前端设计的实时预览。
  • 生成可供移动端访问的二维码,用于测试响应式网页布局。
  • 立即托管临时落地页或 AI 生成的 HTML 片段。
  • 为 CSS/HTML 调试会话提供实时链接,无需本地隧道软件。
HTML Deploy 工作原理
  1. 识别或生成部署所需的 HTML 内容。
  2. 将数据准备为直接的命令参数,或通过临时 JSON 负载准备,以避免 Shell 转义问题。
  3. 使用提供的 PowerShell 脚本或标准 curl 命令向部署 API 发送 POST 请求。
  4. 接收包含唯一公开 URL 和二维码链接的 JSON 响应。
  5. 访问实时站点或分享链接以进行即时查看和跨平台测试。

HTML Deploy 配置指南

要在 Openclaw Skills 中利用此技能,您可以使用捆绑的 PowerShell 脚本或执行手动 curl 命令。对于手动方法(对于复杂代码通常更稳定):

  1. 创建一个名为 temp_payload.json 的临时 JSON 文件,其中包含您的 HTML 内容:
{
  "filename": "index.html",
  "content": "..."
}
  1. 通过终端执行部署:
curl -s -X POST https://www.htmlcode.fun/api/deploy -H "Content-Type: application/json" --data-binary "@temp_payload.json"

HTML Deploy 数据架构与分类体系

部署过程涉及特定的请求结构,并在响应中提供可操作的元数据。

请求负载

属性 类型 描述
filename string 所需的 HTML 文件名(例如 index.html)。
content string 要托管的原始 HTML 代码字符串。

响应元数据

  • url: 托管内容的公开链接(例如 https://www.htmlcode.fun/s/xxxxxx)。
  • qrCode: 指向生成的二维码的 URL,方便移动端访问。
  • cooldownSeconds: 一个整数,表示下次部署前必须等待的时间。
name: html-deploy
description: Deploy HTML content or files to the web via htmlcode.fun. Use when the user asks to "deploy to web", "host this html", "generate a live link for this frontend", or provides HTML code that needs an online preview. Support for single-file HTML deployment with instant URL generation.

HTML Deploy

This skill provides a streamlined workflow to take any HTML code or local HTML file and deploy it to a public URL using the htmlcode.fun service.

Workflow

  1. Extract/Generate HTML: Identify the HTML content to be deployed.
  2. Call Deployment Script: Use the bundled PowerShell script to handle the JSON payload and API call.

Using the Deployment Script

Run the following command in the terminal:

pwsh ./scripts/deploy.ps1 -Content '' -Filename 'your_filename.html'

Note: For complex HTML with many quotes, it is safer to write the JSON payload to a temporary file first and use curl directly as shown in the script's implementation.

Manual Deployment (Preferred for AI)

To avoid shell escaping issues with large HTML strings:

  1. Write the deployment payload to a temporary JSON file:
    {
      "filename": "index.html",
      "content": "..."
    }
    
  2. Execute the deployment via curl:
    curl -s -X POST https://www.htmlcode.fun/api/deploy -H "Content-Type: application/json" --data-binary "@temp_payload.json"
    

API Response

A successful deployment returns a JSON object:

  • url: The live public link (e.g., https://www.htmlcode.fun/s/xxxxxx)
  • qrCode: A link to a QR code for mobile access.
  • cooldownSeconds: Wait time before the next deployment.

Limits

  • Only supports single HTML files.
  • Rate limits apply (typically 10 seconds cooldown).