Skill: ProtoHub AI Agent Integration
Purpose
This skill allows AI Agents to manage prototypes on ProtoHub. It provides automated tools for packaging, publishing, and discovering prototypes (folders or ZIP files) in the ProtoHub Private Sandbox.
Capabilities
- - Automated Publishing: Package a directory or use a ZIP file to create/update prototypes.
- Entry Point Validation: Automatically checks for
index.html before uploading. - Prototype Discovery: List existing prototypes or search by name to find IDs.
- Preview Management: Retrieve public URLs for demonstration.
Mandatory Configuration
Before performing any action, the AI Agent MUST verify that the following environment variables are set:
- -
PROTOHUB_API_KEY: Required for authentication. - INLINECODE2 : Base URL of the ProtoHub server (default:
http://localhost:48080).
Strict Validation Rule:
If either of these is missing from the environment and has not been provided by the user in the current session, the Agent MUST NOT attempt to run the script and MUST NOT retry with placeholder values. Instead, immediately ask the user to provide the missing configuration.
How to set:
CODEBLOCK0
Recommended Tool: publish.py
Usage Examples
1. Upload a Directory as a New Prototype
CODEBLOCK1
2. Update an Existing Prototype
Overwrites content while maintaining the same ID and URL.
CODEBLOCK2
3. List Prototypes (Search by Name)
Useful for finding the ID when the user says "Update the 'Login Page' prototype".
CODEBLOCK3
4. Get Preview Link
CODEBLOCK4
Best Practices
- - Folder Structure: Ensure
index.html is at the root of your directory or ZIP file. - Intelligent Updating:
- If the user asks to "update" a prototype but doesn't provide an ID, use
publish.py list --name "..." to find a matching prototype first.
- If exactly one match is found, use its ID to perform the update.
- If multiple or no matches are found, ask the user for clarification or create a new one.
- - API Base URL: Default is
http://localhost:48080. Override using the PROTOHUB_URL env var or --url flag. - Error Handling:
-
401 Unauthorized: API Key is missing or invalid.
-
404 Not Found: The specified
prototypeId does not exist.
-
Missing index.html: The script will abort the upload to prevent broken previews.
技能:ProtoHub AI Agent集成
目的
此技能允许AI Agent在ProtoHub上管理原型。它提供了自动化工具,用于在ProtoHub私有沙盒中打包、发布和发现原型(文件夹或ZIP文件)。
能力
- - 自动发布: 打包目录或使用ZIP文件创建/更新原型。
- 入口点验证: 上传前自动检查是否存在index.html。
- 原型发现: 列出已有原型或按名称搜索以查找ID。
- 预览管理: 获取用于演示的公开URL。
强制配置
在执行任何操作前,AI Agent必须验证以下环境变量已设置:
- - PROTOHUBAPIKEY:用于身份验证。
- PROTOHUB_URL:ProtoHub服务器的基础URL(默认值:http://localhost:48080)。
严格验证规则:
如果环境中缺少其中任一变量,且用户在当前会话中未提供,Agent不得尝试运行脚本,也不得使用占位值重试。应立即要求用户提供缺失的配置。
设置方式:
bash
export PROTOHUB
APIKEY=your-api-key
export PROTOHUB_URL=http://localhost:48080
推荐工具:publish.py
使用示例
1. 将目录作为新原型上传
bash
python skills/tc-protohub/scripts/publish.py publish ./my-dist-folder --name 我的原型名称
2. 更新已有原型
覆盖内容,同时保持相同的ID和URL。
bash
python skills/tc-protohub/scripts/publish.py publish ./my-dist-folder --id 1024
3. 列出原型(按名称搜索)
当用户说更新登录页面原型时,用于查找ID。
bash
python skills/tc-protohub/scripts/publish.py list --name 登录页面
4. 获取预览链接
bash
python skills/tc-protohub/scripts/publish.py get-link 1024
最佳实践
- - 文件夹结构: 确保index.html位于目录或ZIP文件的根目录。
- 智能更新:
- 如果用户要求更新原型但未提供ID,先使用publish.py list --name ...查找匹配的原型。
- 如果找到恰好一个匹配项,使用其ID执行更新。
- 如果找到多个或未找到匹配项,向用户询问澄清或创建新原型。
- - API基础URL: 默认值为http://localhost:48080。可通过PROTOHUB_URL环境变量或--url标志覆盖。
- 错误处理:
- 401 未授权:API密钥缺失或无效。
- 404 未找到:指定的prototypeId不存在。
- 缺少index.html:脚本将中止上传以防止预览损坏。